From:             
Operating system: Irrelevant
PHP version:      Irrelevant
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:eval is not correctly catching parse error

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 bug report at http://bugs.php.net/bug.php?id=53528&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53528&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53528&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53528&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53528&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53528&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53528&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53528&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53528&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53528&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53528&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53528&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53528&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53528&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53528&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53528&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53528&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53528&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53528&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53528&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53528&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53528&r=mysqlcfg

Reply via email to