compiler fail after previous fail
| Bug #55007 | compiler fail after previous fail | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2011-06-07 14:11 UTC | Modified: | 2011-06-08 00:58 UTC |
|
||||||||||
| From: | sebcsaba at freemail dot hu | Assigned: | felipe (profile) | |||||||||||
| Status: | Closed | Package: | Compile Failure | |||||||||||
| PHP Version: | 5.3.6 | OS: | winxp, ubuntu... (apache) | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2011-06-07 14:11 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2011-06-08 00:58 UTC] felipe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
[2011-06-08 00:58 UTC] felipe@php.net