File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Passing unknown named args to a non-existing ctor
3+ --FILE--
4+ <?php
5+
6+ class Test {}
7+
8+ try {
9+ new stdClass (x: "nope " );
10+ } catch (Error $ e ) {
11+ echo $ e ->getMessage (), "\n" ;
12+ }
13+
14+ try {
15+ new Test (x: "nope " );
16+ } catch (Error $ e ) {
17+ echo $ e ->getMessage (), "\n" ;
18+ }
19+
20+ ?>
21+ --EXPECT--
22+ Unknown named parameter $x
23+ Unknown named parameter $x
Original file line number Diff line number Diff line change @@ -130,13 +130,12 @@ static ZEND_FUNCTION(pass)
130130}
131131
132132ZEND_BEGIN_ARG_INFO_EX (zend_pass_function_arg_info , 0 , 0 , 0 )
133- ZEND_ARG_VARIADIC_INFO (0 , args )
134133ZEND_END_ARG_INFO ()
135134
136135ZEND_API const zend_internal_function zend_pass_function = {
137136 ZEND_INTERNAL_FUNCTION , /* type */
138137 {0 , 0 , 0 }, /* arg_flags */
139- ZEND_ACC_VARIADIC , /* fn_flags */
138+ 0 , /* fn_flags */
140139 NULL , /* name */
141140 NULL , /* scope */
142141 NULL , /* prototype */
@@ -1097,6 +1096,11 @@ static zend_never_inline ZEND_ATTRIBUTE_UNUSED bool zend_verify_internal_arg_typ
10971096 * trust that arginfo matches what is enforced by zend_parse_parameters. */
10981097static zend_always_inline zend_bool zend_internal_call_should_throw (zend_function * fbc , zend_execute_data * call )
10991098{
1099+ if (fbc -> internal_function .handler == ZEND_FN (pass )) {
1100+ /* Be lenient about the special pass function. */
1101+ return 0 ;
1102+ }
1103+
11001104 if (fbc -> common .required_num_args > ZEND_CALL_NUM_ARGS (call )) {
11011105 /* Required argument not passed. */
11021106 return 1 ;
You can’t perform that action at this time.
0 commit comments