From 34325c5e3a37a6cac76e9c864f41107b3b3d1324 Mon Sep 17 00:00:00 2001 From: DanielEScherzer Date: Sun, 22 Sep 2024 16:44:16 -0700 Subject: [PATCH] `zend_assert_valid_class_name()`: use double quotes around names (#15990) --- Zend/tests/errmsg_028.phpt | 4 ++-- Zend/tests/errmsg_029.phpt | 4 ++-- Zend/tests/gh15976/alias-names.phpt | 2 +- Zend/tests/gh15976/class-names.phpt | 2 +- Zend/tests/gh15976/enum-names.phpt | 2 +- Zend/tests/gh15976/interface-names.phpt | 2 +- Zend/tests/gh15976/trait-names.phpt | 2 +- Zend/tests/lazy_objects/unclean_shutdown.phpt | 2 +- Zend/tests/restore_error_reporting.phpt | 2 +- Zend/tests/special_name_error3.phpt | 2 +- .../type_declarations/mixed/syntax/mixed_class_error.phpt | 2 +- .../scalar_relative_typehint_disallowed.phpt | 2 +- Zend/tests/type_declarations/scalar_reserved2.phpt | 2 +- .../tests/type_declarations/scalar_reserved2_class_alias.phpt | 2 +- Zend/tests/type_declarations/scalar_reserved3.phpt | 2 +- .../tests/type_declarations/scalar_reserved3_class_alias.phpt | 2 +- Zend/tests/type_declarations/scalar_reserved4.phpt | 2 +- .../tests/type_declarations/scalar_reserved4_class_alias.phpt | 2 +- Zend/tests/type_declarations/scalar_reserved6.phpt | 2 +- .../tests/type_declarations/scalar_reserved6_class_alias.phpt | 2 +- Zend/tests/type_declarations/scalar_reserved7.phpt | 2 +- Zend/zend_compile.c | 2 +- ext/spl/tests/RecursiveIteratorIterator_dtor_order.phpt | 2 +- 23 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Zend/tests/errmsg_028.phpt b/Zend/tests/errmsg_028.phpt index 9ec39fc0870..e6da8b47fe1 100644 --- a/Zend/tests/errmsg_028.phpt +++ b/Zend/tests/errmsg_028.phpt @@ -1,5 +1,5 @@ --TEST-- -errmsg: cannot use 'self' as class name +errmsg: cannot use "self" as class name --FILE-- --EXPECTF-- -Fatal error: Cannot use 'self' as a class name as it is reserved in %s on line %d +Fatal error: Cannot use "self" as a class name as it is reserved in %s on line %d diff --git a/Zend/tests/errmsg_029.phpt b/Zend/tests/errmsg_029.phpt index 1f33c0d1e0d..fdcb4318f79 100644 --- a/Zend/tests/errmsg_029.phpt +++ b/Zend/tests/errmsg_029.phpt @@ -1,5 +1,5 @@ --TEST-- -errmsg: cannot use 'parent' as class name +errmsg: cannot use "parent" as class name --FILE-- --EXPECTF-- -Fatal error: Cannot use 'parent' as a class name as it is reserved in %s on line %d +Fatal error: Cannot use "parent" as a class name as it is reserved in %s on line %d diff --git a/Zend/tests/gh15976/alias-names.phpt b/Zend/tests/gh15976/alias-names.phpt index 69dd7025a49..d98727d69db 100644 --- a/Zend/tests/gh15976/alias-names.phpt +++ b/Zend/tests/gh15976/alias-names.phpt @@ -10,4 +10,4 @@ class_alias( 'stdClass', 'bool' ); --EXPECTF-- Deprecated: Using "_" as a type alias is deprecated since 8.4 in %salias-names.php on line 3 -Fatal error: Cannot use 'bool' as a type alias as it is reserved in %salias-names.php on line 4 +Fatal error: Cannot use "bool" as a type alias as it is reserved in %salias-names.php on line 4 diff --git a/Zend/tests/gh15976/class-names.phpt b/Zend/tests/gh15976/class-names.phpt index a3a371d629f..a84071e21b2 100644 --- a/Zend/tests/gh15976/class-names.phpt +++ b/Zend/tests/gh15976/class-names.phpt @@ -10,4 +10,4 @@ class bool {} --EXPECTF-- Deprecated: Using "_" as a class name is deprecated since 8.4 in %sclass-names.php on line 3 -Fatal error: Cannot use 'bool' as a class name as it is reserved in %sclass-names.php on line 4 +Fatal error: Cannot use "bool" as a class name as it is reserved in %sclass-names.php on line 4 diff --git a/Zend/tests/gh15976/enum-names.phpt b/Zend/tests/gh15976/enum-names.phpt index 4d3e62e65e9..4bcb8a87660 100644 --- a/Zend/tests/gh15976/enum-names.phpt +++ b/Zend/tests/gh15976/enum-names.phpt @@ -10,4 +10,4 @@ enum bool {} --EXPECTF-- Deprecated: Using "_" as an enum name is deprecated since 8.4 in %senum-names.php on line 3 -Fatal error: Cannot use 'bool' as an enum name as it is reserved in %senum-names.php on line 4 +Fatal error: Cannot use "bool" as an enum name as it is reserved in %senum-names.php on line 4 diff --git a/Zend/tests/gh15976/interface-names.phpt b/Zend/tests/gh15976/interface-names.phpt index 30959047d74..1595ff1964b 100644 --- a/Zend/tests/gh15976/interface-names.phpt +++ b/Zend/tests/gh15976/interface-names.phpt @@ -10,4 +10,4 @@ interface bool {} --EXPECTF-- Deprecated: Using "_" as an interface name is deprecated since 8.4 in %sinterface-names.php on line 3 -Fatal error: Cannot use 'bool' as an interface name as it is reserved in %sinterface-names.php on line 4 +Fatal error: Cannot use "bool" as an interface name as it is reserved in %sinterface-names.php on line 4 diff --git a/Zend/tests/gh15976/trait-names.phpt b/Zend/tests/gh15976/trait-names.phpt index 7bbf0ad6d46..59bc8abfdd8 100644 --- a/Zend/tests/gh15976/trait-names.phpt +++ b/Zend/tests/gh15976/trait-names.phpt @@ -10,4 +10,4 @@ trait bool {} --EXPECTF-- Deprecated: Using "_" as a trait name is deprecated since 8.4 in %strait-names.php on line 3 -Fatal error: Cannot use 'bool' as a trait name as it is reserved in %strait-names.php on line 4 +Fatal error: Cannot use "bool" as a trait name as it is reserved in %strait-names.php on line 4 diff --git a/Zend/tests/lazy_objects/unclean_shutdown.phpt b/Zend/tests/lazy_objects/unclean_shutdown.phpt index a0994292377..62e4c395d09 100644 --- a/Zend/tests/lazy_objects/unclean_shutdown.phpt +++ b/Zend/tests/lazy_objects/unclean_shutdown.phpt @@ -16,4 +16,4 @@ $obj = $reflector->newLazyGhost(function ($obj) { var_dump($obj->a); --EXPECTF-- -Fatal error: Cannot use 'bool' as a class name%s on line %d +Fatal error: Cannot use "bool" as a class name%s on line %d diff --git a/Zend/tests/restore_error_reporting.phpt b/Zend/tests/restore_error_reporting.phpt index 1ba28866855..480de86f734 100644 --- a/Zend/tests/restore_error_reporting.phpt +++ b/Zend/tests/restore_error_reporting.phpt @@ -11,4 +11,4 @@ var_dump($undef_var); Warning: Undefined variable $undef_var in %s on line %d NULL -Fatal error: Cannot use 'self' as a class name as it is reserved in %s on line %d +Fatal error: Cannot use "self" as a class name as it is reserved in %s on line %d diff --git a/Zend/tests/special_name_error3.phpt b/Zend/tests/special_name_error3.phpt index 1174769a128..07029d0847e 100644 --- a/Zend/tests/special_name_error3.phpt +++ b/Zend/tests/special_name_error3.phpt @@ -7,4 +7,4 @@ trait self {} ?> --EXPECTF-- -Fatal error: Cannot use 'self' as a trait name as it is reserved in %s on line %d +Fatal error: Cannot use "self" as a trait name as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/mixed/syntax/mixed_class_error.phpt b/Zend/tests/type_declarations/mixed/syntax/mixed_class_error.phpt index bb2b2c214b3..7070fa1932c 100644 --- a/Zend/tests/type_declarations/mixed/syntax/mixed_class_error.phpt +++ b/Zend/tests/type_declarations/mixed/syntax/mixed_class_error.phpt @@ -9,4 +9,4 @@ class mixed ?> --EXPECTF-- -Fatal error: Cannot use 'mixed' as a class name as it is reserved in %s on line %d +Fatal error: Cannot use "mixed" as a class name as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt b/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt index 3d45348c90c..c22cc2445ac 100644 --- a/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt +++ b/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt @@ -11,4 +11,4 @@ foo(10); ?> --EXPECTF-- -Fatal error: Cannot use 'bar\int' as a type name as it is reserved in %s on line %d +Fatal error: Cannot use "bar\int" as a type name as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_reserved2.phpt b/Zend/tests/type_declarations/scalar_reserved2.phpt index 39fbe669c0f..d0323836c03 100644 --- a/Zend/tests/type_declarations/scalar_reserved2.phpt +++ b/Zend/tests/type_declarations/scalar_reserved2.phpt @@ -6,4 +6,4 @@ Scalar type names cannot be used as class, trait or interface names (2) class int {} ?> --EXPECTF-- -Fatal error: Cannot use 'int' as a class name as it is reserved in %s on line %d +Fatal error: Cannot use "int" as a class name as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_reserved2_class_alias.phpt b/Zend/tests/type_declarations/scalar_reserved2_class_alias.phpt index 48b28bf9586..3e67f24ca3a 100644 --- a/Zend/tests/type_declarations/scalar_reserved2_class_alias.phpt +++ b/Zend/tests/type_declarations/scalar_reserved2_class_alias.phpt @@ -7,4 +7,4 @@ class foobar {} class_alias("foobar", "int"); ?> --EXPECTF-- -Fatal error: Cannot use 'int' as a type alias as it is reserved in %s on line %d +Fatal error: Cannot use "int" as a type alias as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_reserved3.phpt b/Zend/tests/type_declarations/scalar_reserved3.phpt index ecde80e6949..6b08388812e 100644 --- a/Zend/tests/type_declarations/scalar_reserved3.phpt +++ b/Zend/tests/type_declarations/scalar_reserved3.phpt @@ -6,4 +6,4 @@ Scalar type names cannot be used as class, trait or interface names (3) class float {} ?> --EXPECTF-- -Fatal error: Cannot use 'float' as a class name as it is reserved in %s on line %d +Fatal error: Cannot use "float" as a class name as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_reserved3_class_alias.phpt b/Zend/tests/type_declarations/scalar_reserved3_class_alias.phpt index 88bee6354c1..ad51edde8a0 100644 --- a/Zend/tests/type_declarations/scalar_reserved3_class_alias.phpt +++ b/Zend/tests/type_declarations/scalar_reserved3_class_alias.phpt @@ -7,4 +7,4 @@ class foobar {} class_alias("foobar", "float"); ?> --EXPECTF-- -Fatal error: Cannot use 'float' as a type alias as it is reserved in %s on line %d +Fatal error: Cannot use "float" as a type alias as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_reserved4.phpt b/Zend/tests/type_declarations/scalar_reserved4.phpt index 4a392ef22db..1559d181bfa 100644 --- a/Zend/tests/type_declarations/scalar_reserved4.phpt +++ b/Zend/tests/type_declarations/scalar_reserved4.phpt @@ -6,4 +6,4 @@ Scalar type names cannot be used as class, trait or interface names (4) class string {} ?> --EXPECTF-- -Fatal error: Cannot use 'string' as a class name as it is reserved in %s on line %d +Fatal error: Cannot use "string" as a class name as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_reserved4_class_alias.phpt b/Zend/tests/type_declarations/scalar_reserved4_class_alias.phpt index 44a44013a9f..bd1ab6c8ec1 100644 --- a/Zend/tests/type_declarations/scalar_reserved4_class_alias.phpt +++ b/Zend/tests/type_declarations/scalar_reserved4_class_alias.phpt @@ -7,4 +7,4 @@ class foobar {} class_alias("foobar", "string"); ?> --EXPECTF-- -Fatal error: Cannot use 'string' as a type alias as it is reserved in %s on line %d +Fatal error: Cannot use "string" as a type alias as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_reserved6.phpt b/Zend/tests/type_declarations/scalar_reserved6.phpt index 24b747744cf..f821fff9f14 100644 --- a/Zend/tests/type_declarations/scalar_reserved6.phpt +++ b/Zend/tests/type_declarations/scalar_reserved6.phpt @@ -6,4 +6,4 @@ Scalar type names cannot be used as class, trait or interface names (6) class bool {} ?> --EXPECTF-- -Fatal error: Cannot use 'bool' as a class name as it is reserved in %s on line %d +Fatal error: Cannot use "bool" as a class name as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_reserved6_class_alias.phpt b/Zend/tests/type_declarations/scalar_reserved6_class_alias.phpt index 5d1692e7196..1c7f9c0e15f 100644 --- a/Zend/tests/type_declarations/scalar_reserved6_class_alias.phpt +++ b/Zend/tests/type_declarations/scalar_reserved6_class_alias.phpt @@ -7,4 +7,4 @@ class foobar {} class_alias("foobar", "bool"); ?> --EXPECTF-- -Fatal error: Cannot use 'bool' as a type alias as it is reserved in %s on line %d +Fatal error: Cannot use "bool" as a type alias as it is reserved in %s on line %d diff --git a/Zend/tests/type_declarations/scalar_reserved7.phpt b/Zend/tests/type_declarations/scalar_reserved7.phpt index 6fbbc7a924a..a596c3442cd 100644 --- a/Zend/tests/type_declarations/scalar_reserved7.phpt +++ b/Zend/tests/type_declarations/scalar_reserved7.phpt @@ -7,4 +7,4 @@ namespace foo; class int {} ?> --EXPECTF-- -Fatal error: Cannot use 'int' as a class name as it is reserved in %s on line %d +Fatal error: Cannot use "int" as a class name as it is reserved in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 2198533acb6..19c179afe3e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -241,7 +241,7 @@ void zend_assert_valid_class_name(const zend_string *name, const char *type) /* { if (zend_is_reserved_class_name(name)) { zend_error_noreturn(E_COMPILE_ERROR, - "Cannot use '%s' as %s as it is reserved", ZSTR_VAL(name), type); + "Cannot use \"%s\" as %s as it is reserved", ZSTR_VAL(name), type); } if (zend_string_equals_literal(name, "_")) { zend_error(E_DEPRECATED, "Using \"_\" as %s is deprecated since 8.4", type); diff --git a/ext/spl/tests/RecursiveIteratorIterator_dtor_order.phpt b/ext/spl/tests/RecursiveIteratorIterator_dtor_order.phpt index 84faf7c7069..9bc74dc644b 100644 --- a/ext/spl/tests/RecursiveIteratorIterator_dtor_order.phpt +++ b/ext/spl/tests/RecursiveIteratorIterator_dtor_order.phpt @@ -11,4 +11,4 @@ foreach ($it as $v) { } ?> --EXPECTF-- -Fatal error: Cannot use 'self' as a class name as it is reserved in %s on line %d +Fatal error: Cannot use "self" as a class name as it is reserved in %s on line %d