From: neemah86 at gmail dot com Operating system: Debian Lenny (FreeBSD 7.0 also) PHP version: 5.2.9 PHP Bug Type: SPL related Bug description: eval() won't execute from __autoload()
Description: ------------ Hi. Trying to throw exception from __autoload() by evaluating code (eval()). In earlier version of php5 that would give me exception that i need. Now it gives me fatal ignoring eval statement. Reproduce code: --------------- function __autoload_failed() { eval( 'if (!class_exists("ClassNotFoundException", false)) { ' .'final class ClassNotFoundException extends Exception {/*_*/} }' .'throw new ClassNotFoundException("'.$classname.': '.$message.'");' ); } function __autoload($className) { // insert your logic here __autoload_failed($className, 'not found'); // in any place, actually } Expected result: ---------------- ClassNotFoundException thrown Actual result: -------------- Fatal error -- Edit bug report at http://bugs.php.net/?id=48556&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48556&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48556&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48556&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48556&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48556&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48556&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48556&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48556&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48556&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48556&r=support Expected behavior: http://bugs.php.net/fix.php?id=48556&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48556&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48556&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48556&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48556&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48556&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48556&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48556&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48556&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48556&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48556&r=mysqlcfg