summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2007-11-11 22:11:25 +0000
committerJohannes Schlüter <johannes@php.net>2007-11-11 22:11:25 +0000
commit18a656de6fa750406aec4000a47fadbff4f2e52a (patch)
treea150dee530be8dab63d18a780377dac7bb72c8af
parentd7b921c02b1872765df55181c6753583207a814e (diff)
downloadphp-git-18a656de6fa750406aec4000a47fadbff4f2e52a.tar.gz
- MFH: static can't be used as type hint, fixes #43126 (Etienne Kneuss)
-rw-r--r--Zend/tests/lsb_006.phpt2
-rw-r--r--Zend/tests/lsb_007.phpt2
-rw-r--r--Zend/zend_language_parser.y22
3 files changed, 17 insertions, 9 deletions
diff --git a/Zend/tests/lsb_006.phpt b/Zend/tests/lsb_006.phpt
index f5e2b045eb..e6296a9674 100644
--- a/Zend/tests/lsb_006.phpt
+++ b/Zend/tests/lsb_006.phpt
@@ -9,4 +9,4 @@ class Foo extends static {
?>
==DONE==
--EXPECTF--
-Fatal error: Cannot use 'static' as class name as it is reserved in %s on line %d
+Parse error: syntax error, unexpected T_STATIC, expecting T_STRING or T_PAAMAYIM_NEKUDOTAYIM in %s on line %d
diff --git a/Zend/tests/lsb_007.phpt b/Zend/tests/lsb_007.phpt
index a20a826166..6366f09b0f 100644
--- a/Zend/tests/lsb_007.phpt
+++ b/Zend/tests/lsb_007.phpt
@@ -9,4 +9,4 @@ class Foo implements static {
?>
==DONE==
--EXPECTF--
-Fatal error: Cannot use 'static' as interface name as it is reserved in %s on line %d
+Parse error: syntax error, unexpected T_STATIC, expecting T_STRING or T_PAAMAYIM_NEKUDOTAYIM in %s on line %d
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index d7a2d82e19..517b93a612 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -634,10 +634,10 @@ function_call:
| T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { $3.u.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.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
- | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
+ | class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { 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);}
- | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
+ | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(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); }
@@ -651,15 +651,23 @@ function_call:
{ zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
;
-fully_qualified_class_name:
+class_name:
T_STRING { $$ = $1; }
| T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1, 1);}
| T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_build_namespace_name(&$$, NULL, &$2 TSRMLS_CC); }
+ | class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_build_namespace_name(&$$, &$1, &$3 TSRMLS_CC); }
+;
+
+fully_qualified_class_name:
+ T_STRING { $$ = $1; }
+ | T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_build_namespace_name(&$$, NULL, &$2 TSRMLS_CC); }
| fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_build_namespace_name(&$$, &$1, &$3 TSRMLS_CC); }
;
+
+
class_name_reference:
- fully_qualified_class_name { zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
+ class_name { zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
| dynamic_class_name_reference { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
;
@@ -719,7 +727,7 @@ static_scalar: /* compile-time evaluated scalars */
;
static_class_constant:
- fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT, 0 TSRMLS_CC); }
+ class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT, 0 TSRMLS_CC); }
;
scalar:
@@ -802,7 +810,7 @@ variable_without_objects:
;
static_member:
- fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); }
+ class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); }
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); }
;
@@ -933,7 +941,7 @@ isset_variables:
;
class_constant:
- fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); }
+ class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); }
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); }
;