#31888 [NEW]: return in eval does not return

From: Date: Tue, 08 Feb 2005 20:20:27 +0000
Subject: #31888 [NEW]: return in eval does not return
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73659@lists.php.net to get a copy of this message
From: quinn at quinn dot student dot utwente dot nl Operating system: Linux Gentoo 2.4.28 PHP version: 5.0.3 PHP Bug Type: *General Issues Bug description: return in eval does not return Description: ------------ According to the documentation a return in eval should return the value passed to the return statement. This works fine outside functions or classes. But when you want to eval a function or a function in a class this does not work. Reproduce code: --------------- class aap{ static function aap1(){ return 'aap'; } } function text(){ return 'text'; } $a = eval('text();'); echo $a; $b = eval("return 'output';"); echo $b; $c = eval("aap::aap1();"); echo $c; Expected result: ---------------- text output aap Actual result: -------------- output -- Edit bug report at http://bugs.php.net/?id=31888&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31888&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31888&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31888&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31888&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31888&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31888&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31888&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31888&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31888&r=support Expected behavior: http://bugs.php.net/fix.php?id=31888&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31888&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31888&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31888&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31888&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31888&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31888&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31888&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31888&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31888&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31888&r=mysqlcfg

« previous php.bugs (#73659) next »