#31542 [Opn->Csd]: eval() terminates PHP on fatal error instead of returning false
| From: | vrana@php.net | Date: | Fri, 14 Jan 2005 16:02:58 +0000 |
| Subject: | #31542 [Opn->Csd]: eval() terminates PHP on fatal error instead of returning false | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969365975@lists.php.net to get a copy of this message | ||
ID: 31542
Updated by: vrana@php.net
Reported By: jcmailtrap-php at yahoo dot ca
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: RHEL3
PHP Version: 5.0.3
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Changed to: "In case of a parse error in the evaluated code, eval()
returns FALSE."
Previous Comments:
------------------------------------------------------------------------
[2005-01-14 05:39:05] sniper@php.net
So the one who wrote the manual page made a mistake since
eval() isn't some magic thing that can override fatal errors..
------------------------------------------------------------------------
[2005-01-14 05:31:46] jcmailtrap-php at yahoo dot ca
Well, in eval()'s manual page, it is stated:
In case of a fatal error in the evaluated code, eval() returns FALSE.
Obviously eval() did not return FALSE in this case because the script
exited.
------------------------------------------------------------------------
[2005-01-14 05:26:58] sniper@php.net
Fatal errors are...tadaa..FATAL! As such -> exit.
No bug here.
------------------------------------------------------------------------
[2005-01-14 05:19:51] jed@php.net
Don't all E_ERRORs do this?
------------------------------------------------------------------------
[2005-01-13 18:14:34] jcmailtrap-php at yahoo dot ca
Description:
------------
When a fatal error is caused by attempting to call a method on an
non-object or non-existing variable, eval() throws a fatal error which
terminates the script instead of returning false as stated in the doc.
Reproduce code:
---------------
$result = eval('$nosuchobject->method();');
echo "done eval\n";
if ($result===false) {
echo "error correctly returned\n";
}
Expected result:
----------------
Notice: Undefined variable: nosuchobject
Fatal error: Call to a member function method() on a non-object
done eval
error correctly returned
Actual result:
--------------
Notice: Undefined variable: nosuchobject
Fatal error: Call to a member function method() on a non-object
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31542&edit=1