diff options
-rw-r--r-- | Zend/tests/bug55247.phpt | 33 | ||||
-rw-r--r-- | Zend/zend_language_parser.y | 4 |
2 files changed, 35 insertions, 2 deletions
diff --git a/Zend/tests/bug55247.phpt b/Zend/tests/bug55247.phpt new file mode 100644 index 0000000000..6fa893f892 --- /dev/null +++ b/Zend/tests/bug55247.phpt @@ -0,0 +1,33 @@ +--TEST-- +Request #55247 (Parser problem with static calls using string method name) +--FILE-- +<?php +class Test{ + public static function __callStatic($method, $arguments) + { + echo $method . PHP_EOL; + } + public function __call($method, $arguments) + { + echo $method . PHP_EOL; + } +} + +$method = 'method'; + +$test = new Test(); + +$test->method(); +$test->$method(); +$test->{'method'}(); + +Test::method(); +Test::$method(); +Test::{'method'}(); +--EXPECT-- +method +method +method +method +method +method diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index f89c1f121c..ef390ffd56 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -797,13 +797,13 @@ function_call: | T_NS_SEPARATOR namespace_name '(' { $3.u.op.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(&$2, &$$, &$5, 0, $3.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } - | class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { $4.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + | class_name T_PAAMAYIM_NEKUDOTAYIM variable_name '(' { $4.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call($4.u.op.opline_num?NULL:&$3, &$$, &$6, $4.u.op.opline_num, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } |