Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ PHP NEWS
(nielsdos, ilutov)
. Fix may_have_extra_named_args flag for ZEND_AST_UNPACK. (nielsdos)
. Fix NULL arithmetic in System V shared memory emulation for Windows. (cmb)
. Fixed bug GH-17597 (#[\Deprecated] does not work for __call() and
__callStatic()). (timwolla)

- DOM:
. Fixed bug GH-17397 (Assertion failure ext/dom/php_dom.c). (nielsdos)
Expand Down
24 changes: 24 additions & 0 deletions Zend/tests/attributes/deprecated/functions/magic_call.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
#[\Deprecated]: __call() and __callStatic()
--FILE--
<?php

class Clazz {
#[\Deprecated]
function __call(string $name, array $params) {
}

#[\Deprecated("due to some reason")]
static function __callStatic(string $name, array $params) {
}
}

$cls = new Clazz();
$cls->test();
Clazz::test2();

?>
--EXPECTF--
Deprecated: Method Clazz::test() is deprecated in %s

Deprecated: Method Clazz::test2() is deprecated, due to some reason in %s on line %d
8 changes: 7 additions & 1 deletion Zend/zend_object_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,13 @@ ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce
func->fn_flags = ZEND_ACC_CALL_VIA_TRAMPOLINE
| ZEND_ACC_PUBLIC
| ZEND_ACC_VARIADIC
| (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE);
| (fbc->common.fn_flags & (ZEND_ACC_RETURN_REFERENCE|ZEND_ACC_DEPRECATED));
if (fbc->common.attributes) {
func->attributes = fbc->common.attributes;
GC_TRY_ADDREF(func->attributes);
} else {
func->attributes = NULL;
}
if (is_static) {
func->fn_flags |= ZEND_ACC_STATIC;
}
Expand Down
5 changes: 5 additions & 0 deletions Zend/zend_object_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,12 @@ ZEND_API bool ZEND_FASTCALL zend_asymmetric_property_has_set_access(const zend_p
} while (0)

#define zend_free_trampoline(func) do { \
HashTable *attributes = (func)->common.attributes; \
if (attributes && !(GC_FLAGS(attributes) & GC_IMMUTABLE) && !GC_DELREF(attributes)) { \
zend_array_destroy(attributes); \
} \
if ((func) == &EG(trampoline)) { \
EG(trampoline).common.attributes = NULL; \
EG(trampoline).common.function_name = NULL; \
} else { \
efree(func); \
Expand Down
Loading