Edit report at http://bugs.php.net/bug.php?id=53528&edit=1
ID: 53528 Updated by: [email protected] Reported by: php at dynamicplus dot it Summary: eval is not correctly catching parse error -Status: Open +Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: That's a runtime fatal error, not a parse error, and hence results in the script execution halting, as per the second note on the eval() manual page. Previous Comments: ------------------------------------------------------------------------ [2010-12-12 18:30:41] php at dynamicplus dot it Description: ------------ --- >From manual page: http://www.php.net/function.eval#Return Values --- eval() shoud return FALSE in case of parse error. In this example crashes completely with a fatal error, executing a dead portion of code. A return should terminate the eval script as soon as is encountered. Seems to be a compilation problem. Test script: --------------- <?php $return = eval( 'return TRUE; /* should never come here */ WrongAssignment() = 1234;' ); ?> Expected result: ---------------- $return should be FALSE as there is a PARSE ERROR (from manual: "If there is a parse error in the evaluated code, eval() returns FALSE and execution of the following code continues normally."). But the parse error is not detected and in this case $return should be TRUE, as the first block simply returns TRUE and the rest is dead-code. Actual result: -------------- Fatal error: Can't use function return value in write context in /Users/dynamicplus/eval-demo.php(3) : eval()'d code on line 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53528&edit=1
