diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 0ccb4ec68f5..b74fa0fc7a0 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3281,7 +3281,10 @@ ZEND_API zend_result zend_register_class_alias_ex(const char *name, size_t name_ if (!(ce->ce_flags & ZEND_ACC_IMMUTABLE)) { ce->refcount++; } - zend_observer_class_linked_notify(ce, lcname); + // avoid notifying at MINIT time + if (ce->type == ZEND_USER_CLASS) { + zend_observer_class_linked_notify(ce, lcname); + } return SUCCESS; } return FAILURE; diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index e87d81acfeb..b1c86e79c24 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -35,6 +35,7 @@ #include "zend_inheritance.h" #include "zend_exceptions.h" #include "zend_mmap.h" +#include "zend_observer.h" #include "main/php_main.h" #include "main/SAPI.h" #include "main/php_streams.h" @@ -4480,6 +4481,7 @@ static int accel_preload(const char *config, bool in_child) script->script.main_op_array.fn_flags |= ZEND_ACC_DONE_PASS_TWO; script->script.main_op_array.last = 1; script->script.main_op_array.last_literal = 1; + script->script.main_op_array.T = ZEND_OBSERVER_ENABLED; #if ZEND_USE_ABS_CONST_ADDR script->script.main_op_array.literals = (zval*)emalloc(sizeof(zval)); #else diff --git a/ext/zend_test/tests/observer_preload.inc b/ext/zend_test/tests/observer_preload.inc new file mode 100644 index 00000000000..7652014f91b --- /dev/null +++ b/ext/zend_test/tests/observer_preload.inc @@ -0,0 +1,13 @@ + +--EXPECTF-- + + + + + + + + + + + + + +Done + \ No newline at end of file