File tree Expand file tree Collapse file tree 3 files changed +55
-1
lines changed Expand file tree Collapse file tree 3 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ PHP NEWS
1111 . Fixed bug GH-19844 (Don't bail when closing resources on shutdown). (ilutov)
1212 . Fixed bug GH-20177 (Accessing overridden private property in
1313 get_object_vars() triggers assertion error). (ilutov)
14+ . Fixed bug GH-20270 (Broken parent hook call with named arguments). (ilutov)
1415
1516- DOM:
1617 . Partially fixed bug GH-16317 (DOM classes do not allow
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-20270: Parent hook call with named arguments
3+ --CREDITS--
4+ Viet Hoang Luu (@vi3tL0u1s)
5+ --FILE--
6+ <?php
7+
8+ class A {
9+ public mixed $ prop1 ;
10+ public mixed $ prop2 {
11+ set(mixed $ custom ) => $ custom ;
12+ }
13+ }
14+
15+ class B extends A {
16+ public mixed $ prop1 {
17+ set {
18+ parent ::$ prop1 ::set (value: 42 );
19+ parent ::$ prop1 ::set (unknown: 43 );
20+ }
21+ }
22+ public mixed $ prop2 {
23+ set {
24+ parent ::$ prop2 ::set (custom: 42 );
25+ parent ::$ prop2 ::set (value: 43 );
26+ }
27+ }
28+ }
29+
30+ $ b = new B ();
31+
32+ try {
33+ $ b ->prop1 = 0 ;
34+ } catch (Error $ e ) {
35+ echo $ e ->getMessage (), "\n" ;
36+ }
37+ var_dump ($ b ->prop1 );
38+
39+ try {
40+ $ b ->prop2 = 0 ;
41+ } catch (Error $ e ) {
42+ echo $ e ->getMessage (), "\n" ;
43+ }
44+ var_dump ($ b ->prop2 );
45+
46+ ?>
47+ --EXPECT--
48+ Unknown named parameter $unknown
49+ int(42)
50+ Unknown named parameter $value
51+ int(42)
Original file line number Diff line number Diff line change @@ -1783,7 +1783,9 @@ ZEND_API zend_function *zend_get_property_hook_trampoline(
17831783 const zend_property_info * prop_info ,
17841784 zend_property_hook_kind kind , zend_string * prop_name )
17851785{
1786- static const zend_arg_info arg_info [1 ] = {{0 }};
1786+ static const zend_internal_arg_info arg_info [2 ] = {
1787+ { .name = "value" }
1788+ };
17871789 zend_function * func ;
17881790 if (EXPECTED (EG (trampoline ).common .function_name == NULL )) {
17891791 func = & EG (trampoline );
You can’t perform that action at this time.
0 commit comments