File tree Expand file tree Collapse file tree 4 files changed +36
-1
lines changed
tests/attributes/deprecated/functions Expand file tree Collapse file tree 4 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ PHP NEWS
2020 (nielsdos, ilutov)
2121 . Fix may_have_extra_named_args flag for ZEND_AST_UNPACK. (nielsdos)
2222 . Fix NULL arithmetic in System V shared memory emulation for Windows. (cmb)
23+ . Fixed bug GH-17597 (#[\Deprecated] does not work for __call() and
24+ __callStatic()). (timwolla)
2325
2426- DOM:
2527 . Fixed bug GH-17397 (Assertion failure ext/dom/php_dom.c). (nielsdos)
Original file line number Diff line number Diff line change 1+ --TEST--
2+ #[\Deprecated]: __call() and __callStatic()
3+ --FILE--
4+ <?php
5+
6+ class Clazz {
7+ #[\Deprecated]
8+ function __call (string $ name , array $ params ) {
9+ }
10+
11+ #[\Deprecated("due to some reason " )]
12+ static function __callStatic (string $ name , array $ params ) {
13+ }
14+ }
15+
16+ $ cls = new Clazz ();
17+ $ cls ->test ();
18+ Clazz::test2 ();
19+
20+ ?>
21+ --EXPECTF--
22+ Deprecated: Method Clazz::test() is deprecated in %s
23+
24+ Deprecated: Method Clazz::test2() is deprecated, due to some reason in %s on line %d
Original file line number Diff line number Diff line change @@ -1617,7 +1617,12 @@ ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce
16171617 func -> fn_flags = ZEND_ACC_CALL_VIA_TRAMPOLINE
16181618 | ZEND_ACC_PUBLIC
16191619 | ZEND_ACC_VARIADIC
1620- | (fbc -> common .fn_flags & ZEND_ACC_RETURN_REFERENCE );
1620+ | (fbc -> common .fn_flags & (ZEND_ACC_RETURN_REFERENCE |ZEND_ACC_DEPRECATED ));
1621+ if (fbc -> common .attributes ) {
1622+ func -> attributes = zend_array_dup (fbc -> common .attributes );
1623+ } else {
1624+ func -> attributes = NULL ;
1625+ }
16211626 if (is_static ) {
16221627 func -> fn_flags |= ZEND_ACC_STATIC ;
16231628 }
Original file line number Diff line number Diff line change @@ -339,6 +339,10 @@ ZEND_API bool ZEND_FASTCALL zend_asymmetric_property_has_set_access(const zend_p
339339} while (0)
340340
341341#define zend_free_trampoline (func ) do { \
342+ if ((func)->common.attributes) { \
343+ zend_array_destroy((func)->common.attributes); \
344+ (func)->common.attributes = NULL; \
345+ } \
342346 if ((func) == &EG(trampoline)) { \
343347 EG(trampoline).common.function_name = NULL; \
344348 } else { \
You can’t perform that action at this time.
0 commit comments