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' into PHP-8.5

* PHP-8.4:
  Fix parent hook call with named args
This commit is contained in:
Ilija Tovilo
2025-10-27 16:39:02 +01:00
3 changed files with 57 additions and 1 deletions

3
NEWS
View File

@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.5.0RC4
- Core:
. Fixed bug GH-20270 (Broken parent hook call with named arguments). (ilutov)
- Reflection:
. Fixed bug GH-20217 (ReflectionClass::isIterable() incorrectly returns true
for classes with property hooks). (alexandre-daubois)

View File

@@ -0,0 +1,51 @@
--TEST--
GH-20270: Parent hook call with named arguments
--CREDITS--
Viet Hoang Luu (@vi3tL0u1s)
--FILE--
<?php
class A {
public mixed $prop1;
public mixed $prop2 {
set(mixed $custom) => $custom;
}
}
class B extends A {
public mixed $prop1 {
set {
parent::$prop1::set(value: 42);
parent::$prop1::set(unknown: 43);
}
}
public mixed $prop2 {
set {
parent::$prop2::set(custom: 42);
parent::$prop2::set(value: 43);
}
}
}
$b = new B();
try {
$b->prop1 = 0;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($b->prop1);
try {
$b->prop2 = 0;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($b->prop2);
?>
--EXPECT--
Unknown named parameter $unknown
int(42)
Unknown named parameter $value
int(42)

View File

@@ -1787,7 +1787,9 @@ ZEND_API zend_function *zend_get_property_hook_trampoline(
const zend_property_info *prop_info,
zend_property_hook_kind kind, zend_string *prop_name)
{
static const zend_arg_info arg_info[1] = {{0}};
static const zend_internal_arg_info arg_info[2] = {
{ .name = "value" }
};
zend_function *func;
if (EXPECTED(EG(trampoline).common.function_name == NULL)) {
func = &EG(trampoline);