From 610366adb80b546ccf117afa2d45b7eaff3073d2 Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Sun, 22 Sep 2024 13:57:20 -0700 Subject: [PATCH] `zend_assert_valid_class_name()`: use double quotes around names --- 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 9ec39fc087002..e6da8b47fe1c0 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 1f33c0d1e0df2..fdcb4318f7918 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 69dd7025a4960..d98727d69dbc5 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 a3a371d629f31..a84071e21b2f0 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 4d3e62e65e959..4bcb8a876608d 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 30959047d747b..1595ff1964b9d 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 7bbf0ad6d465d..59bc8abfdd855 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 a099429237719..62e4c395d0935 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 1ba28866855cb..480de86f734e7 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 1174769a128fe..07029d0847e1b 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 bb2b2c214b32e..7070fa1932c4f 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 3d45348c90c00..c22cc2445acf8 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 39fbe669c0fac..d0323836c0348 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 48b28bf9586c9..3e67f24ca3abb 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 ecde80e6949ed..6b08388812e23 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 88bee6354c1b8..ad51edde8a07c 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 4a392ef22db60..1559d181bfab5 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 44a44013a9ff6..bd1ab6c8ec10b 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 24b747744cf03..f821fff9f141b 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 5d1692e7196f2..1c7f9c0e15f7b 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 6fbbc7a924af9..a596c3442cd16 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 2198533acb655..19c179afe3e31 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 84faf7c7069d3..9bc74dc644be1 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