Also fixes duplicate bugs #54054 and #42098.
Furthermore this fixes incorrect error messages thrown from code
running inside an error handler when a compilation is in progress.
The error file and line are now correctly associated with the
file/line of the executor, rather than the compiler.
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2013, PHP 5.4.21
+- Core:
+ . Fixed bug #65322 (compile time errors won't trigger auto loading). (Nikita)
+
- CLI server:
. Fixed bug #65633 (built-in server treat some http headers as
case-sensitive). (Adam)
--- /dev/null
+--TEST--
+Bug #65322: compile time errors won't trigger auto loading
+--FILE--
+<?php
+
+spl_autoload_register(function($class) {
+ var_dump($class);
+ class B {}
+});
+
+set_error_handler(function($_, $msg, $file) {
+ var_dump($msg, $file);
+ new B;
+});
+
+eval('class A { function a() {} function __construct() {} }');
+
+?>
+--EXPECTF--
+string(50) "Redefining already defined constructor for class A"
+string(%d) "%s(%d) : eval()'d code"
+string(1) "B"
--- /dev/null
+--TEST--
+Error message in error handler during compilation
+--FILE--
+<?php
+
+set_error_handler(function($_, $msg, $file) {
+ var_dump($msg, $file);
+ echo $undefined;
+});
+
+eval('class A { function a() {} function __construct() {} }');
+
+?>
+--EXPECTF--
+string(50) "Redefining already defined constructor for class A"
+string(%d) "%s(%d) : eval()'d code"
+
+Notice: Undefined variable: undefined in %s on line %d
* such scripts recursivly, but some CG() variables may be
* inconsistent. */
- in_compilation = zend_is_compiling(TSRMLS_C);
+ in_compilation = CG(in_compilation);
if (in_compilation) {
saved_class_entry = CG(active_class_entry);
CG(active_class_entry) = NULL;
SAVE_STACK(declare_stack);
SAVE_STACK(list_stack);
SAVE_STACK(context_stack);
+ CG(in_compilation) = 0;
}
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
RESTORE_STACK(declare_stack);
RESTORE_STACK(list_stack);
RESTORE_STACK(context_stack);
+ CG(in_compilation) = 1;
}
if (!EG(user_error_handler)) {