From:
Operating system: winxp, ubuntu... (apache)
PHP version: 5.3.6
Package: Compile Failure
Bug Type: Bug
Bug description:compiler fail after previous fail
Description:
------------
If a class loading (eval or require_once) fails by an E_COMPILE_ERROR (e.g.
"Cannot use [] for reading") inside a class declaration, the next class
load parse will fail, (perhaps) because the compiler starts it's syntax
tree stack from the error of previous class, and gives 'Class declarations
may not be nested' fatal error.
Test script:
---------------
function __autoload($classname) {
if ('CompileErrorClass'==$classname) eval('class CompileErrorClass {
function foo() { $a[] } }');
if ('MyErrorHandler'==$classname) eval('class MyErrorHandler { function
__construct() { print "My error handler runs."; } }');
}
function shutdown() {
new MyErrorHandler();
}
register_shutdown_function('shutdown');
new CompileErrorClass();
Expected result:
----------------
Fatal error: Cannot use [] for reading in D:\docroot\tests\bugreport.php(5)
: eval()'d code on line 1
Fatal error: Class 'CompileErrorClass' not found in
D:\docroot\tests\bugreport.php on line 16
My error handler runs.
Actual result:
--------------
Fatal error: Cannot use [] for reading in D:\docroot\tests\bugreport.php(5)
: eval()'d code on line 1
Fatal error: Class declarations may not be nested in
D:\docroot\tests\bugreport.php(6) : eval()'d code on line 1
--
Edit bug report at http://bugs.php.net/bug.php?id=55007&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=55007&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=55007&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=55007&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=55007&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=55007&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=55007&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=55007&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=55007&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=55007&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=55007&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=55007&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=55007&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=55007&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=55007&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=55007&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=55007&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=55007&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=55007&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=55007&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=55007&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=55007&r=mysqlcfg