diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index f9b888f1c166b..61df70c4ec8a4 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -6315,6 +6315,7 @@ static int call_attribute_constructor( dummy_func.type = ZEND_USER_FUNCTION; dummy_func.common.fn_flags = attr->flags & ZEND_ATTRIBUTE_STRICT_TYPES ? ZEND_ACC_STRICT_TYPES : 0; + dummy_func.common.fn_flags |= ZEND_ACC_CALL_VIA_TRAMPOLINE; dummy_func.op_array.filename = filename; dummy_opline.opcode = ZEND_DO_FCALL; diff --git a/ext/zend_test/tests/observer_bug81430_1.phpt b/ext/zend_test/tests/observer_bug81430_1.phpt new file mode 100644 index 0000000000000..cac53ef70cbbb --- /dev/null +++ b/ext/zend_test/tests/observer_bug81430_1.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #81430 (Attribute instantiation frame accessing invalid frame pointer) +--EXTENSIONS-- +zend_test +--INI-- +memory_limit=20M +zend_test.observer.enabled=1 +zend_test.observer.observe_all=1 +--FILE-- +getAttributes(A::class)[0], 'newInstance']); +?> +--EXPECTF-- + + + + + + diff --git a/ext/zend_test/tests/observer_bug81430_2.phpt b/ext/zend_test/tests/observer_bug81430_2.phpt new file mode 100644 index 0000000000000..4d56248a80f34 --- /dev/null +++ b/ext/zend_test/tests/observer_bug81430_2.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #81430 (Attribute instantiation leaves dangling execute_data pointer) +--EXTENSIONS-- +zend_test +--INI-- +memory_limit=20M +zend_test.observer.enabled=1 +zend_test.observer.observe_all=1 +--FILE-- +getAttributes(A::class)[0], 'newInstance']); +?> +--EXPECTF-- + + + + + +Fatal error: Allowed memory size of %d bytes exhausted %s in %s on line %d + +