php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #28331 Fatal Errors
Submitted: 2004-05-09 04:13 UTC Modified: -
Votes:10
Avg. Score:4.9 ± 0.3
Reproduced:9 of 10 (90.0%)
Same Version:5 (55.6%)
Same OS:3 (33.3%)
From: microcamers at hotmail dot com Assigned:
Status: Open Package: Feature/Change Request
PHP Version: 5CVS-2004-05-09 (dev) OS: Windows XP
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-05-09 04:13 UTC] microcamers at hotmail dot com
Description:
------------
Can you make it possible to make most fatal errors catchable, such as the ones for undefined functions, classes, redefined things and so on. Generally make it so any error that can be caught can be caught.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-07 19:54 UTC] paul dot ossenbruggen at websidestory dot com
It would be especially useful to be able to catch a missing 
function or method errors in an eval() statement with 
arbitrary code. This can be used in a unit test situation 
where you want the script to continue to complete other tests.
 [2012-02-21 13:54 UTC] lang at b1-systems dot de
+1 from my side. Mixing and matching expressions with fatals and return-0-checks is evil and clutters the code. 

Rationale:

At least methods on non-objects can happen when you come from javascript or similar scripting communities which encourage chaining/nesting calls to more or less human-readable commands like

$granny_name = $baby->getMother()->getMother()->getName();

In PHP you would rather do


$mother = $baby->getMother();

if ($mother) {
    $granny = $mother->getMother();
    if ($granny) {
        $granny_name  = $granny->getName();
    }
}

A comment would be welcome if such a patch would generally be apreciated or you want to keep this fatal as a design decision. If the change is welcome, i'll see if I can provide a patch.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 19:01:53 2014 UTC