zend_resolve_const_class_name_reference(): use double quotes around names (#15998)

This is a follow-up to #15990, as it turns out there was a second place that emits this kind of error message.
This commit is contained in:
DanielEScherzer 2024-09-23 01:59:48 -07:00 committed by GitHub
parent 8e6d8cf1fa
commit 702fb31894
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 17 additions and 17 deletions

View File

@ -9,4 +9,4 @@ class Test {
?>
--EXPECTF--
Fatal error: Cannot use 'static' as trait name, as it is reserved in %s on line %d
Fatal error: Cannot use "static" as trait name, as it is reserved in %s on line %d

View File

@ -1,5 +1,5 @@
--TEST--
errmsg: cannot use 'self' as parent class name
errmsg: cannot use "self" as parent class name
--FILE--
<?php
@ -9,4 +9,4 @@ class test extends self {
echo "Done\n";
?>
--EXPECTF--
Fatal error: Cannot use 'self' as class name, as it is reserved in %s on line %d
Fatal error: Cannot use "self" as class name, as it is reserved in %s on line %d

View File

@ -1,5 +1,5 @@
--TEST--
errmsg: cannot use 'parent' as parent class name
errmsg: cannot use "parent" as parent class name
--FILE--
<?php
@ -9,4 +9,4 @@ class test extends parent {
echo "Done\n";
?>
--EXPECTF--
Fatal error: Cannot use 'parent' as class name, as it is reserved in %s on line %d
Fatal error: Cannot use "parent" as class name, as it is reserved in %s on line %d

View File

@ -1,5 +1,5 @@
--TEST--
errmsg: cannot use 'self' as interface name
errmsg: cannot use "self" as interface name
--FILE--
<?php
@ -9,4 +9,4 @@ class test implements self {
echo "Done\n";
?>
--EXPECTF--
Fatal error: Cannot use 'self' as interface name, as it is reserved in %s on line %d
Fatal error: Cannot use "self" as interface name, as it is reserved in %s on line %d

View File

@ -1,5 +1,5 @@
--TEST--
errmsg: cannot use 'parent' as interface name
errmsg: cannot use "parent" as interface name
--FILE--
<?php
@ -9,4 +9,4 @@ class test implements parent {
echo "Done\n";
?>
--EXPECTF--
Fatal error: Cannot use 'parent' as interface name, as it is reserved in %s on line %d
Fatal error: Cannot use "parent" as interface name, as it is reserved in %s on line %d

View File

@ -7,4 +7,4 @@ interface Foo extends static {}
?>
--EXPECTF--
Fatal error: Cannot use 'static' as interface name, as it is reserved in %s on line %d
Fatal error: Cannot use "static" as interface name, as it is reserved in %s on line %d

View File

@ -1,5 +1,5 @@
--TEST--
ZE2 Late Static Binding ensuring extending 'static' is not allowed
ZE2 Late Static Binding ensuring extending "static" is not allowed
--FILE--
<?php
@ -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
Fatal error: Cannot use "static" as class name, as it is reserved in %s on line %d

View File

@ -1,5 +1,5 @@
--TEST--
ZE2 Late Static Binding ensuring implementing 'static' is not allowed
ZE2 Late Static Binding ensuring implementing "static" is not allowed
--FILE--
<?php
@ -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
Fatal error: Cannot use "static" as interface name, as it is reserved in %s on line %d

View File

@ -15,4 +15,4 @@ class Test {
?>
--EXPECTF--
Fatal error: Cannot use 'static' as trait name, as it is reserved in %s on line %d
Fatal error: Cannot use "static" as trait name, as it is reserved in %s on line %d

View File

@ -15,4 +15,4 @@ class Test {
?>
--EXPECTF--
Fatal error: Cannot use 'static' as trait name, as it is reserved in %s on line %d
Fatal error: Cannot use "static" as trait name, as it is reserved in %s on line %d

View File

@ -1764,7 +1764,7 @@ static zend_string *zend_resolve_const_class_name_reference(zend_ast *ast, const
zend_string *class_name = zend_ast_get_str(ast);
if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type_ast(ast)) {
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot use '%s' as %s, as it is reserved",
"Cannot use \"%s\" as %s, as it is reserved",
ZSTR_VAL(class_name), type);
}
return zend_resolve_class_name(class_name, ast->attr);