|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-08-07 12:12 UTC] vrana@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 07:00:01 2025 UTC |
Description: ------------ The manual says: > In PHP 4, eval() returns NULL unless return() is called in the evaluated code... This is not true. PHP returns FALSE if a fatal error occurs. This is very important especially for CLI/SAPI applications which must often catch fatal errors and propogate them with exit(1). Reproduce code: --------------- <?php // FILE: test/test.php $x=eval(";"); echo "Non-Fatal Error Returns: "; if($x===FALSE) echo "FALSE\n"; if(is_null($x)) echo "NULL\n"; $x=eval("<?"); echo "Fatal Error Returns: "; if($x===FALSE) echo "FALSE\n"; if(is_null($x)) echo "NULL\n"; ?> Expected result: ---------------- OUTPUT: $ php test/test.php Non-Fatal Error Returns: NULL PHP Parse error: parse error in /usr/local/apache/htdocs/common/php/xmake_org/xobj/test/test.php(6) : eval()'d code on line 1 Fatal Error Returns: FALSE