File tree 5 files changed +40
-11
lines changed
tests/attributes/deprecated/functions
5 files changed +40
-11
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ PHP NEWS
19
19
may call hooks of overridden properties). (Arnaud)
20
20
. Fixed bug GH-17916 (Final abstract properties should error).
21
21
(DanielEScherzer)
22
+ . Fixed bug GH-17866 (zend_mm_heap corrupted error after upgrading from
23
+ 8.4.3 to 8.4.4). (nielsdos)
22
24
23
25
- DOM:
24
26
. Fixed bug GH-17609 (Typo in error message: Dom\NO_DEFAULT_NS instead of
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-17866 (zend_mm_heap corrupted error after upgrading from 8.4.3 to 8.4.4)
3
+ --FILE--
4
+ <?php
5
+
6
+ class Foo {
7
+ #[Deprecated("xyzzy " )]
8
+ public function __invoke () {
9
+ echo "In __invoke \n" ;
10
+ }
11
+ }
12
+
13
+ $ foo = new Foo ;
14
+ $ closure = Closure::fromCallable ($ foo );
15
+ $ test = $ closure ->__invoke (...);
16
+
17
+ $ rc = new ReflectionMethod ($ test , '__invoke ' );
18
+ var_dump ($ rc ->getAttributes ());
19
+ var_dump ($ rc ->isDeprecated ());
20
+
21
+ $ test ();
22
+
23
+ ?>
24
+ --EXPECTF--
25
+ array(1) {
26
+ [0]=>
27
+ object(ReflectionAttribute)#%d (1) {
28
+ ["name"]=>
29
+ string(10) "Deprecated"
30
+ }
31
+ }
32
+ bool(true)
33
+
34
+ Deprecated: Method Foo::__invoke() is deprecated, xyzzy in %s on line %d
35
+ In __invoke
Original file line number Diff line number Diff line change @@ -464,7 +464,7 @@ ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *object) /* {
464
464
zend_closure * closure = (zend_closure * )object ;
465
465
zend_function * invoke = (zend_function * )emalloc (sizeof (zend_function ));
466
466
const uint32_t keep_flags =
467
- ZEND_ACC_RETURN_REFERENCE | ZEND_ACC_VARIADIC | ZEND_ACC_HAS_RETURN_TYPE ;
467
+ ZEND_ACC_RETURN_REFERENCE | ZEND_ACC_VARIADIC | ZEND_ACC_HAS_RETURN_TYPE | ZEND_ACC_DEPRECATED ;
468
468
469
469
invoke -> common = closure -> func .common ;
470
470
/* We return ZEND_INTERNAL_FUNCTION, but arg_info representation is the
Original file line number Diff line number Diff line change @@ -1618,12 +1618,8 @@ ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce
1618
1618
| ZEND_ACC_PUBLIC
1619
1619
| ZEND_ACC_VARIADIC
1620
1620
| (fbc -> common .fn_flags & (ZEND_ACC_RETURN_REFERENCE |ZEND_ACC_ABSTRACT |ZEND_ACC_DEPRECATED ));
1621
- if (fbc -> common .attributes ) {
1622
- func -> attributes = fbc -> common .attributes ;
1623
- GC_TRY_ADDREF (func -> attributes );
1624
- } else {
1625
- func -> attributes = NULL ;
1626
- }
1621
+ /* Attributes outlive the trampoline because they are created by the compiler. */
1622
+ func -> attributes = fbc -> common .attributes ;
1627
1623
if (is_static ) {
1628
1624
func -> fn_flags |= ZEND_ACC_STATIC ;
1629
1625
}
Original file line number Diff line number Diff line change @@ -339,10 +339,6 @@ ZEND_API bool ZEND_FASTCALL zend_asymmetric_property_has_set_access(const zend_p
339
339
} while (0)
340
340
341
341
#define zend_free_trampoline (func ) do { \
342
- HashTable *attributes = (func)->common.attributes; \
343
- if (attributes && !(GC_FLAGS(attributes) & GC_IMMUTABLE) && !GC_DELREF(attributes)) { \
344
- zend_array_destroy(attributes); \
345
- } \
346
342
if ((func) == &EG(trampoline)) { \
347
343
EG(trampoline).common.attributes = NULL; \
348
344
EG(trampoline).common.function_name = NULL; \
You can’t perform that action at this time.
0 commit comments