From:             gk at proliberty dot com
Operating system: linux ; kernel 2.4.18
PHP version:      4.3.2
PHP Bug Type:     Documentation problem
Bug description:  eval() documentation ignores FALSE return value from Fatal Errors

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


-- 
Edit bug report at http://bugs.php.net/?id=24135&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24135&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24135&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24135&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24135&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24135&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24135&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24135&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24135&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24135&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24135&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24135&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24135&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24135&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24135&r=gnused


-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to