1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4'

* PHP-8.4:
  Fix `#[\Deprecated]` for `__call()` and `__callStatic()` (#17592)
This commit is contained in:
Tim Düsterhus
2025-01-27 13:41:50 +01:00
3 changed files with 36 additions and 1 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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); \