File tree Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Expand file tree Collapse file tree 2 files changed +54
-1
lines changed 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 @@ -1788,7 +1788,9 @@ ZEND_API zend_function *zend_get_property_hook_trampoline(
17881788 const zend_property_info * prop_info ,
17891789 zend_property_hook_kind kind , zend_string * prop_name )
17901790{
1791- static const zend_arg_info arg_info [1 ] = {{0 }};
1791+ static const zend_internal_arg_info arg_info [2 ] = {
1792+ { .name = "value" }
1793+ };
17921794 zend_function * func ;
17931795 if (EXPECTED (EG (trampoline ).common .function_name == NULL )) {
17941796 func = & EG (trampoline );
You can’t perform that action at this time.
0 commit comments