From 702fb31894098207d1a34cf073331020117009be Mon Sep 17 00:00:00 2001 From: DanielEScherzer Date: Mon, 23 Sep 2024 01:59:48 -0700 Subject: [PATCH] `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. --- Zend/tests/class_uses_static.phpt | 2 +- Zend/tests/errmsg_030.phpt | 4 ++-- Zend/tests/errmsg_031.phpt | 4 ++-- Zend/tests/errmsg_035.phpt | 4 ++-- Zend/tests/errmsg_036.phpt | 4 ++-- Zend/tests/interface_extends_static.phpt | 2 +- Zend/tests/lsb_006.phpt | 4 ++-- Zend/tests/lsb_007.phpt | 4 ++-- Zend/tests/static_in_trait_insteadof_list.phpt | 2 +- Zend/tests/static_in_trait_insteadof_reference.phpt | 2 +- Zend/zend_compile.c | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Zend/tests/class_uses_static.phpt b/Zend/tests/class_uses_static.phpt index df34e5b6af4..97e01a3f768 100644 --- a/Zend/tests/class_uses_static.phpt +++ b/Zend/tests/class_uses_static.phpt @@ -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 diff --git a/Zend/tests/errmsg_030.phpt b/Zend/tests/errmsg_030.phpt index 589965cf08c..8ab45455fad 100644 --- a/Zend/tests/errmsg_030.phpt +++ b/Zend/tests/errmsg_030.phpt @@ -1,5 +1,5 @@ --TEST-- -errmsg: cannot use 'self' as parent class name +errmsg: cannot use "self" as parent class name --FILE-- --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 diff --git a/Zend/tests/errmsg_031.phpt b/Zend/tests/errmsg_031.phpt index ed1d0bec2d7..83df35c033a 100644 --- a/Zend/tests/errmsg_031.phpt +++ b/Zend/tests/errmsg_031.phpt @@ -1,5 +1,5 @@ --TEST-- -errmsg: cannot use 'parent' as parent class name +errmsg: cannot use "parent" as parent class name --FILE-- --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 diff --git a/Zend/tests/errmsg_035.phpt b/Zend/tests/errmsg_035.phpt index 140e3e9cf47..a6ab5d1d553 100644 --- a/Zend/tests/errmsg_035.phpt +++ b/Zend/tests/errmsg_035.phpt @@ -1,5 +1,5 @@ --TEST-- -errmsg: cannot use 'self' as interface name +errmsg: cannot use "self" as interface name --FILE-- --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 diff --git a/Zend/tests/errmsg_036.phpt b/Zend/tests/errmsg_036.phpt index 33c6bca1d6a..43255aae983 100644 --- a/Zend/tests/errmsg_036.phpt +++ b/Zend/tests/errmsg_036.phpt @@ -1,5 +1,5 @@ --TEST-- -errmsg: cannot use 'parent' as interface name +errmsg: cannot use "parent" as interface name --FILE-- --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 diff --git a/Zend/tests/interface_extends_static.phpt b/Zend/tests/interface_extends_static.phpt index 3d12070ec8d..2821bdeebba 100644 --- a/Zend/tests/interface_extends_static.phpt +++ b/Zend/tests/interface_extends_static.phpt @@ -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 diff --git a/Zend/tests/lsb_006.phpt b/Zend/tests/lsb_006.phpt index 9d1600d425a..2847efa777b 100644 --- a/Zend/tests/lsb_006.phpt +++ b/Zend/tests/lsb_006.phpt @@ -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-- ==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 diff --git a/Zend/tests/lsb_007.phpt b/Zend/tests/lsb_007.phpt index 970044eab29..c2f6265530d 100644 --- a/Zend/tests/lsb_007.phpt +++ b/Zend/tests/lsb_007.phpt @@ -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-- ==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 diff --git a/Zend/tests/static_in_trait_insteadof_list.phpt b/Zend/tests/static_in_trait_insteadof_list.phpt index 77ecf1e42ba..f0458a09d87 100644 --- a/Zend/tests/static_in_trait_insteadof_list.phpt +++ b/Zend/tests/static_in_trait_insteadof_list.phpt @@ -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 diff --git a/Zend/tests/static_in_trait_insteadof_reference.phpt b/Zend/tests/static_in_trait_insteadof_reference.phpt index 95a6b3c1706..d97d66993a8 100644 --- a/Zend/tests/static_in_trait_insteadof_reference.phpt +++ b/Zend/tests/static_in_trait_insteadof_reference.phpt @@ -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 diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 19c179afe3e..99938df0c8f 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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);