|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/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
[2011-06-08 00:58 UTC] felipe@php.net
[2012-04-18 09:50 UTC] laruence@php.net
[2012-07-24 23:41 UTC] rasmus@php.net
[2013-11-17 09:37 UTC] laruence@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
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