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)
130
130
}
131
131
132
132
ZEND_BEGIN_ARG_INFO_EX (zend_pass_function_arg_info , 0 , 0 , 0 )
133
- ZEND_ARG_VARIADIC_INFO (0 , args )
134
133
ZEND_END_ARG_INFO ()
135
134
136
135
ZEND_API const zend_internal_function zend_pass_function = {
137
136
ZEND_INTERNAL_FUNCTION , /* type */
138
137
{0 , 0 , 0 }, /* arg_flags */
139
- ZEND_ACC_VARIADIC , /* fn_flags */
138
+ 0 , /* fn_flags */
140
139
NULL , /* name */
141
140
NULL , /* scope */
142
141
NULL , /* prototype */
@@ -1097,6 +1096,11 @@ static zend_never_inline ZEND_ATTRIBUTE_UNUSED bool zend_verify_internal_arg_typ
1097
1096
* trust that arginfo matches what is enforced by zend_parse_parameters. */
1098
1097
static zend_always_inline zend_bool zend_internal_call_should_throw (zend_function * fbc , zend_execute_data * call )
1099
1098
{
1099
+ if (fbc -> internal_function .handler == ZEND_FN (pass )) {
1100
+ /* Be lenient about the special pass function. */
1101
+ return 0 ;
1102
+ }
1103
+
1100
1104
if (fbc -> common .required_num_args > ZEND_CALL_NUM_ARGS (call )) {
1101
1105
/* Required argument not passed. */
1102
1106
return 1 ;
You can’t perform that action at this time.
0 commit comments