Edit report at http://bugs.php.net/bug.php?id=55007&edit=1

 ID:                 55007
 Updated by:         [email protected]
 Reported by:        sebcsaba at freemail dot hu
 Summary:            compiler fail after previous fail
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Compile Failure
 Operating System:   winxp, ubuntu... (apache)
 PHP Version:        5.3.6
-Assigned To:        
+Assigned To:        felipe
 Block user comment: N
 Private report:     N

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2011-06-07 14:11:25] sebcsaba at freemail dot hu

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 this bug report at http://bugs.php.net/bug.php?id=55007&edit=1

Reply via email to