Skip to content

Commit

Permalink
Try to allow reserved keywords, not working yet
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jun 5, 2020
1 parent 54fe82b commit 902339e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions Zend/tests/named_params/reserved.phpt
@@ -0,0 +1,17 @@
--TEST--
Reserved keywords can be used with named parameters
--FILE--
<?php

function test($array) {
var_dump($array);
}

test(array => []);

?>
--EXPECTF--
Fatal error: Uncaught Error: Unknown named parameter $=> in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
2 changes: 1 addition & 1 deletion Zend/zend_language_parser.y
Expand Up @@ -765,7 +765,7 @@ non_empty_argument_list:

argument:
expr { $$ = $1; }
| T_STRING T_DOUBLE_ARROW expr
| identifier T_DOUBLE_ARROW expr
{ $$ = zend_ast_create(ZEND_AST_NAMED_ARG, $1, $3); }
| T_ELLIPSIS expr { $$ = zend_ast_create(ZEND_AST_UNPACK, $2); }
;
Expand Down

0 comments on commit 902339e

Please sign in to comment.