Req #28331 [Opn->Csd]: Fatal Errors

From: Date: Sat, 21 Mar 2015 20:15:10 +0000
Subject: Req #28331 [Opn->Csd]: Fatal Errors
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191508@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=28331&edit=1

 ID:                 28331
 Updated by:         nikic@php.net
 Reported by:        microcamers at hotmail dot com
 Summary:            Fatal Errors
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   Irrelevant
 PHP Version:        *
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Implemented in PHP 7.


Previous Comments:
------------------------------------------------------------------------
[2015-01-08 22:57:18] ajf@php.net

This would be fixed by this RFC, if adopted: https://wiki.php.net/rfc/engine_exceptions_for_php7

------------------------------------------------------------------------
[2012-02-21 13:54:16] 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.

------------------------------------------------------------------------
[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=28331&edit=1


Thread (5 messages)

« previous php.bugs (#191508) next »