File tree 3 files changed +36
-1
lines changed
tests/attributes/deprecated/functions
3 files changed +36
-1
lines changed 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,13 @@ ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce
1617
1617
func -> fn_flags = ZEND_ACC_CALL_VIA_TRAMPOLINE
1618
1618
| ZEND_ACC_PUBLIC
1619
1619
| 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 = fbc -> common .attributes ;
1623
+ GC_TRY_ADDREF (func -> attributes );
1624
+ } else {
1625
+ func -> attributes = NULL ;
1626
+ }
1621
1627
if (is_static ) {
1622
1628
func -> fn_flags |= ZEND_ACC_STATIC ;
1623
1629
}
Original file line number Diff line number Diff line change @@ -339,7 +339,12 @@ 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
+ } \
342
346
if ((func) == &EG(trampoline)) { \
347
+ EG(trampoline).common.attributes = NULL; \
343
348
EG(trampoline).common.function_name = NULL; \
344
349
} else { \
345
350
efree(func); \
You can’t perform that action at this time.
0 commit comments