Edit report at https://bugs.php.net/bug.php?id=28331edit=1
ID: 28331
Comment by: lang at b1-systems dot de
Reported by:microcamers at hotmail dot com
Summary:Fatal Errors
Status: Open
Type: Feature/Change Request
Package:Feature/Change Request
Operating System: Windows XP
PHP Version:5CVS-2004-05-09 (dev)
Block user comment: N
Private report: N
New Comment:
+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.
Previous Comments:
[2005-12-07 19:54:21] 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.
[2004-05-09 04:13:48] 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.
--
Edit this bug report at https://bugs.php.net/bug.php?id=28331edit=1