diff --git a/Zend/tests/anon/gh15994.phpt b/Zend/tests/anon/gh15994.phpt index 815b392ada43..b5c619a24b08 100644 --- a/Zend/tests/anon/gh15994.phpt +++ b/Zend/tests/anon/gh15994.phpt @@ -10,4 +10,4 @@ abstract class ParentClass { $o = new class extends ParentClass {}; ?> --EXPECTF-- -Fatal error: Class ParentClass@anonymous must implement 1 abstract method (ParentClass::f) in %sgh15994.php on line 7 +Fatal error: Class ParentClass@anonymous%0%s:7$0 must implement 1 abstract method (ParentClass::f) in %s on line %d diff --git a/Zend/tests/attributes/override/constants/anon_failure.phpt b/Zend/tests/attributes/override/constants/anon_failure.phpt index c43cedda81d7..4fc1c26a4dc5 100644 --- a/Zend/tests/attributes/override/constants/anon_failure.phpt +++ b/Zend/tests/attributes/override/constants/anon_failure.phpt @@ -12,4 +12,4 @@ echo "Done"; ?> --EXPECTF-- -Fatal error: class@anonymous::C has #[\Override] attribute, but no matching parent constant exists in %s on line %d +Fatal error: class@anonymous%0%s:3$%x::C has #[\Override] attribute, but no matching parent constant exists in %s on line %d diff --git a/Zend/tests/attributes/override/properties_16.phpt b/Zend/tests/attributes/override/properties_16.phpt index 57ea17818c40..bc9bb1a9b8b5 100644 --- a/Zend/tests/attributes/override/properties_16.phpt +++ b/Zend/tests/attributes/override/properties_16.phpt @@ -18,4 +18,4 @@ echo "Done"; ?> --EXPECTF-- -Fatal error: I@anonymous::$c has #[\Override] attribute, but no matching parent property exists in %s on line %d +Fatal error: I@anonymous%0%s:7$%x::$c has #[\Override] attribute, but no matching parent property exists in %s on line %d diff --git a/Zend/tests/dynamic_prop_deprecation_002.phpt b/Zend/tests/dynamic_prop_deprecation_002.phpt index bd0d3aa5a7df..19b1e3cf3b47 100644 --- a/Zend/tests/dynamic_prop_deprecation_002.phpt +++ b/Zend/tests/dynamic_prop_deprecation_002.phpt @@ -13,6 +13,6 @@ try { echo "Exception: " .$ex->getMessage() . "\n"; } ?> ---EXPECT-- -Err: Creation of dynamic property class@anonymous::$y is deprecated -Exception: Cannot create dynamic property class@anonymous::$y +--EXPECTF-- +Err: Creation of dynamic property class@anonymous%0%s:6$%x::$y is deprecated +Exception: Cannot create dynamic property class@anonymous%0%s:6$%x::$y diff --git a/Zend/tests/gh19304.phpt b/Zend/tests/gh19304.phpt index 47e20af64623..f3bdc44444bb 100644 --- a/Zend/tests/gh19304.phpt +++ b/Zend/tests/gh19304.phpt @@ -14,5 +14,5 @@ try { } ?> ---EXPECT-- -Cannot assign int to property class@anonymous::$v of type self +--EXPECTF-- +Cannot assign int to property class@anonymous%0%s:3$0::$v of type self diff --git a/Zend/tests/readonly_classes/gh10377_1.phpt b/Zend/tests/readonly_classes/gh10377_1.phpt index fba1605ff084..f371b55b8278 100644 --- a/Zend/tests/readonly_classes/gh10377_1.phpt +++ b/Zend/tests/readonly_classes/gh10377_1.phpt @@ -12,4 +12,4 @@ $readonly_anon = new #[AllowDynamicProperties] readonly class { ?> --EXPECTF-- -Fatal error: Cannot apply #[\AllowDynamicProperties] to readonly class class@anonymous in %s on line %d +Fatal error: Cannot apply #[\AllowDynamicProperties] to readonly class class@anonymous%0%s:3$%x in %s on line %d diff --git a/Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt b/Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt index 6e6dc58baad0..eb786782b6f0 100644 --- a/Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt +++ b/Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt @@ -284,27 +284,27 @@ caught Exception 3 caught Exception 4 caught Exception 5 -Deprecated: Creation of dynamic property class@anonymous::$foo is deprecated in %s on line %d +Deprecated: Creation of dynamic property class@anonymous%0%s:41$%x::$foo is deprecated in %s on line %d caught Exception 6 caught Exception 7 caught Exception 8 caught Exception 9 caught Exception 10 -Deprecated: Creation of dynamic property class@anonymous::$foo is deprecated in %s on line %d +Deprecated: Creation of dynamic property class@anonymous%0%s:92$%x::$foo is deprecated in %s on line %d caught Exception 11 -Deprecated: Creation of dynamic property class@anonymous::$foo is deprecated in %s on line %d +Deprecated: Creation of dynamic property class@anonymous%0%s:101$%x::$foo is deprecated in %s on line %d caught Exception 12 caught Exception 13 -Deprecated: Creation of dynamic property class@anonymous::$foo is deprecated in %s on line %d +Deprecated: Creation of dynamic property class@anonymous%0%s:116$%x::$foo is deprecated in %s on line %d caught Exception 14 -Notice: Indirect modification of overloaded element of ArrayAccess@anonymous has no effect in %s on line %d +Notice: Indirect modification of overloaded element of ArrayAccess@anonymous%0%s:125$%x has no effect in %s on line %d caught Exception 15 -Notice: Indirect modification of overloaded element of ArrayAccess@anonymous has no effect in %s on line %d +Notice: Indirect modification of overloaded element of ArrayAccess@anonymous%0%s:135$%x has no effect in %s on line %d caught Exception 16 caught Exception 17 caught Exception 18 diff --git a/Zend/tests/type_declarations/typed_properties_002.phpt b/Zend/tests/type_declarations/typed_properties_002.phpt index b10aaf95bf80..1994e253e006 100644 --- a/Zend/tests/type_declarations/typed_properties_002.phpt +++ b/Zend/tests/type_declarations/typed_properties_002.phpt @@ -9,7 +9,7 @@ $thing = new class() { var_dump($thing->int); ?> --EXPECTF-- -Fatal error: Uncaught Error: Typed property class@anonymous::$int must not be accessed before initialization in %s:%d +Fatal error: Uncaught Error: Typed property class@anonymous%0%s:2$%x::$int must not be accessed before initialization in %s:%d Stack trace: #0 {main} thrown in %s on line 6 diff --git a/Zend/tests/type_declarations/typed_properties_003.phpt b/Zend/tests/type_declarations/typed_properties_003.phpt index 6cde9cc60434..51cdba919a19 100644 --- a/Zend/tests/type_declarations/typed_properties_003.phpt +++ b/Zend/tests/type_declarations/typed_properties_003.phpt @@ -9,7 +9,7 @@ $thing = new class() { $var = &$thing->int; ?> --EXPECTF-- -Fatal error: Uncaught Error: Cannot access uninitialized non-nullable property class@anonymous::$int by reference in %s:%d +Fatal error: Uncaught Error: Cannot access uninitialized non-nullable property class@anonymous%0%s:2$%x::$int by reference in %s:%d Stack trace: #0 {main} thrown in %s on line %d diff --git a/Zend/tests/type_declarations/typed_properties_004.phpt b/Zend/tests/type_declarations/typed_properties_004.phpt index eb8e1ef6b4a3..32f2f35c5f0c 100644 --- a/Zend/tests/type_declarations/typed_properties_004.phpt +++ b/Zend/tests/type_declarations/typed_properties_004.phpt @@ -11,7 +11,7 @@ new class("PHP 7 is better than you, and it knows it ...") { }; ?> --EXPECTF-- -Fatal error: Uncaught TypeError: Cannot assign string to property class@anonymous::$int of type int in %s:%d +Fatal error: Uncaught TypeError: Cannot assign string to property class@anonymous%0%s:2$%x::$int of type int in %s:%d Stack trace: #0 %s(%d): class@anonymous->__construct('PHP 7 is better...') #1 {main} diff --git a/Zend/tests/type_declarations/typed_properties_005.phpt b/Zend/tests/type_declarations/typed_properties_005.phpt index 71f264a926aa..dc5d11f36490 100644 --- a/Zend/tests/type_declarations/typed_properties_005.phpt +++ b/Zend/tests/type_declarations/typed_properties_005.phpt @@ -13,7 +13,7 @@ new class(new Dummy) { }; ?> --EXPECTF-- -Fatal error: Uncaught TypeError: Cannot assign Dummy to property class@anonymous::$std of type stdClass in %s:%d +Fatal error: Uncaught TypeError: Cannot assign Dummy to property class@anonymous%0%s:4$%x::$std of type stdClass in %s:%d Stack trace: #0 %s(%d): class@anonymous->__construct(Object(Dummy)) #1 {main} diff --git a/Zend/tests/type_declarations/typed_properties_033.phpt b/Zend/tests/type_declarations/typed_properties_033.phpt index 665026f07565..b08ac7d6796b 100644 --- a/Zend/tests/type_declarations/typed_properties_033.phpt +++ b/Zend/tests/type_declarations/typed_properties_033.phpt @@ -25,7 +25,7 @@ try { var_dump($foo); ?> --EXPECTF-- -Cannot assign float to reference held by property class@anonymous::$qux of type int +Cannot assign float to reference held by property class@anonymous%0%s:2$%x::$qux of type int object(class@anonymous)#1 (4) { ["foo"]=> int(2) diff --git a/Zend/tests/type_declarations/typed_properties_034.phpt b/Zend/tests/type_declarations/typed_properties_034.phpt index 4af6baa80aef..5bec7afb7686 100644 --- a/Zend/tests/type_declarations/typed_properties_034.phpt +++ b/Zend/tests/type_declarations/typed_properties_034.phpt @@ -36,13 +36,13 @@ try { var_dump($foo); ?> ---EXPECT-- +--EXPECTF-- int(42) -Cannot assign null to property class@anonymous::$baz of type int +Cannot assign null to property class@anonymous%0%s:2$0::$baz of type int int(1) int(10) int(10) -Cannot assign null to reference held by property class@anonymous::$baz of type int +Cannot assign null to reference held by property class@anonymous%0%s:2$%x::$baz of type int object(class@anonymous)#1 (2) { ["bar"]=> &int(10) diff --git a/Zend/tests/type_declarations/typed_properties_038.phpt b/Zend/tests/type_declarations/typed_properties_038.phpt index 4bb5b75a28fe..bcc07abd3f84 100644 --- a/Zend/tests/type_declarations/typed_properties_038.phpt +++ b/Zend/tests/type_declarations/typed_properties_038.phpt @@ -40,22 +40,22 @@ try { var_dump($foo); ?> --EXPECTF-- -string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value" +string(%d) "Cannot increment property class@anonymous%0%s:3$%x::$bar of type int past its maximal value" object(class@anonymous)#1 (1) { ["bar"]=> int(%d) } -string(65) "Cannot assign float to property class@anonymous::$bar of type int" +string(%d) "Cannot assign float to property class@anonymous%0%s:3$%x::$bar of type int" object(class@anonymous)#1 (1) { ["bar"]=> int(%d) } -string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value" +string(%d) "Cannot increment property class@anonymous%0%s:3$%x::$bar of type int past its maximal value" object(class@anonymous)#1 (1) { ["bar"]=> int(%d) } -string(65) "Cannot assign float to property class@anonymous::$bar of type int" +string(%d) "Cannot assign float to property class@anonymous%0%s:3$%x::$bar of type int" object(class@anonymous)#1 (1) { ["bar"]=> int(%d) diff --git a/Zend/tests/type_declarations/typed_properties_044.phpt b/Zend/tests/type_declarations/typed_properties_044.phpt index f32cd928444e..6d120f0b1ef9 100644 --- a/Zend/tests/type_declarations/typed_properties_044.phpt +++ b/Zend/tests/type_declarations/typed_properties_044.phpt @@ -47,12 +47,12 @@ try { } ?> ---EXPECT-- +--EXPECTF-- int(0) int(-2) int(-1) int(-1) -Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value -Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value -Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value -Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value +Cannot increment a reference held by property class@anonymous%0%s:2$%x::$bar of type ?int past its maximal value +Cannot increment a reference held by property class@anonymous%0%s:2$%x::$bar of type ?int past its maximal value +Cannot decrement a reference held by property class@anonymous%0%s:2$%x::$bar of type ?int past its minimal value +Cannot decrement a reference held by property class@anonymous%0%s:2$%x::$bar of type ?int past its minimal value diff --git a/Zend/tests/type_declarations/typed_properties_062.phpt b/Zend/tests/type_declarations/typed_properties_062.phpt index 6e1242e9901e..481a033d53ff 100644 --- a/Zend/tests/type_declarations/typed_properties_062.phpt +++ b/Zend/tests/type_declarations/typed_properties_062.phpt @@ -61,21 +61,21 @@ $a->_ = 1; var_dump($a->foo); ?> ---EXPECT-- +--EXPECTF-- int(2) int(21) -Cannot assign string to reference held by property class@anonymous::$foo of type int +Cannot assign string to reference held by property class@anonymous%0%s:3$%x::$foo of type int int(21) int(20) int(19) -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +Cannot decrement a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its minimal value integer -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +Cannot decrement a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its minimal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +Cannot increment a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its maximal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +Cannot increment a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its maximal value integer -Cannot assign array to reference held by property class@anonymous::$foo of type int +Cannot assign array to reference held by property class@anonymous%0%s:3$%x::$foo of type int int(0) int(1) diff --git a/Zend/tests/type_declarations/typed_properties_063.phpt b/Zend/tests/type_declarations/typed_properties_063.phpt index b67e95c24b39..0668b4b84b6e 100644 --- a/Zend/tests/type_declarations/typed_properties_063.phpt +++ b/Zend/tests/type_declarations/typed_properties_063.phpt @@ -60,21 +60,21 @@ $_ = 1; var_dump($a->foo); ?> ---EXPECT-- +--EXPECTF-- int(2) int(21) -Cannot assign string to reference held by property class@anonymous::$foo of type int +Cannot assign string to reference held by property class@anonymous%0%s:3$%x::$foo of type int int(21) int(20) int(19) -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +Cannot decrement a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its minimal value integer -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +Cannot decrement a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its minimal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +Cannot increment a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its maximal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +Cannot increment a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its maximal value integer -Cannot assign array to reference held by property class@anonymous::$foo of type int +Cannot assign array to reference held by property class@anonymous%0%s:3$%x::$foo of type int int(0) int(1) diff --git a/Zend/tests/type_declarations/typed_properties_064.phpt b/Zend/tests/type_declarations/typed_properties_064.phpt index dd7b5517a7f1..852912d8fbaf 100644 --- a/Zend/tests/type_declarations/typed_properties_064.phpt +++ b/Zend/tests/type_declarations/typed_properties_064.phpt @@ -60,21 +60,21 @@ $_[0] = 1; var_dump($a->foo); ?> ---EXPECT-- +--EXPECTF-- int(2) int(21) -Cannot assign string to reference held by property class@anonymous::$foo of type int +Cannot assign string to reference held by property class@anonymous%0%s:3$%x::$foo of type int int(21) int(20) int(19) -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +Cannot decrement a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its minimal value integer -Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +Cannot decrement a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its minimal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +Cannot increment a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its maximal value integer -Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +Cannot increment a reference held by property class@anonymous%0%s:3$%x::$foo of type int past its maximal value integer -Cannot assign array to reference held by property class@anonymous::$foo of type int +Cannot assign array to reference held by property class@anonymous%0%s:3$%x::$foo of type int int(0) int(1) diff --git a/Zend/tests/type_declarations/typed_properties_065.phpt b/Zend/tests/type_declarations/typed_properties_065.phpt index a3a536da07e1..cf556e82b222 100644 --- a/Zend/tests/type_declarations/typed_properties_065.phpt +++ b/Zend/tests/type_declarations/typed_properties_065.phpt @@ -52,7 +52,7 @@ try { echo gettype($a->foo),"\n"; ?> ---EXPECT-- +--EXPECTF-- offsetSet(2) int(1) offsetSet(11) @@ -61,11 +61,11 @@ offsetSet(1e50) int(1) int(0) int(-1) -Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value +Cannot decrement a reference held by property ArrayAccess@anonymous%0%s:3$%x::$foo of type int past its minimal value integer -Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value +Cannot decrement a reference held by property ArrayAccess@anonymous%0%s:3$%x::$foo of type int past its minimal value integer -Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value +Cannot increment a reference held by property ArrayAccess@anonymous%0%s:3$%x::$foo of type int past its maximal value integer -Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value +Cannot increment a reference held by property ArrayAccess@anonymous%0%s:3$%x::$foo of type int past its maximal value integer diff --git a/Zend/tests/type_declarations/typed_properties_078.phpt b/Zend/tests/type_declarations/typed_properties_078.phpt index 07e9384b6f54..c00da11ed57e 100644 --- a/Zend/tests/type_declarations/typed_properties_078.phpt +++ b/Zend/tests/type_declarations/typed_properties_078.phpt @@ -42,18 +42,18 @@ $ref = new ArrayIterator(); var_dump($ref instanceof ArrayIterator); ?> ---EXPECT-- +--EXPECTF-- array(0) { } -string(72) "Cannot assign array to property class@anonymous::$t of type ?Traversable" +string(%d) "Cannot assign array to property class@anonymous%0%s:3$%x::$t of type ?Traversable" array(0) { } array(1) { [0]=> int(1) } -string(92) "Cannot assign ArrayIterator to reference held by property class@anonymous::$a of type ?array" +string(%d) "Cannot assign ArrayIterator to reference held by property class@anonymous%0%s:3$%x::$a of type ?array" bool(false) -string(90) "Cannot assign array to reference held by property class@anonymous::$t of type ?Traversable" +string(%d) "Cannot assign array to reference held by property class@anonymous%0%s:3$%x::$t of type ?Traversable" bool(false) bool(true) diff --git a/Zend/tests/type_declarations/union_types/anonymous_class.phpt b/Zend/tests/type_declarations/union_types/anonymous_class.phpt index 1e009f22b00f..82dc41c57570 100644 --- a/Zend/tests/type_declarations/union_types/anonymous_class.phpt +++ b/Zend/tests/type_declarations/union_types/anonymous_class.phpt @@ -26,5 +26,5 @@ try { } ?> --EXPECTF-- -class@anonymous(): Argument #1 ($a) must be of type class@anonymous|string, null given, called in %s on line %d +class@anonymous%0%s:3$%x::testParam(): Argument #1 ($a) must be of type class@anonymous|string, null given, called in %s on line %d class@anonymous::test(): Return value must be of type class@anonymous|string, stdClass returned diff --git a/Zend/zend.c b/Zend/zend.c index b1ad3f4fe7f3..7202fe1b51ef 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -194,8 +194,8 @@ static ZEND_INI_MH(OnUpdateMaxAllowedStackSize) /* {{{ */ zend_long size = zend_ini_parse_quantity_warn(new_value, entry->name); if (size < ZEND_MAX_ALLOWED_STACK_SIZE_UNCHECKED) { - zend_error(E_WARNING, "Invalid \"%s\" setting. Value must be >= %d, but got " ZEND_LONG_FMT, - ZSTR_VAL(entry->name), ZEND_MAX_ALLOWED_STACK_SIZE_UNCHECKED, size); + zend_error(E_WARNING, "Invalid \"%pS\" setting. Value must be >= %d, but got " ZEND_LONG_FMT, + entry->name, ZEND_MAX_ALLOWED_STACK_SIZE_UNCHECKED, size); return FAILURE; } @@ -228,8 +228,8 @@ static ZEND_INI_MH(OnUpdateReservedStackSize) /* {{{ */ if (size == 0) { size = min; } else if (size < min) { - zend_error(E_WARNING, "Invalid \"%s\" setting. Value must be >= " ZEND_ULONG_FMT ", but got " ZEND_ULONG_FMT "\n", - ZSTR_VAL(entry->name), min, size); + zend_error(E_WARNING, "Invalid \"%pS\" setting. Value must be >= " ZEND_ULONG_FMT ", but got " ZEND_ULONG_FMT "\n", + entry->name, min, size); return FAILURE; } @@ -1830,13 +1830,9 @@ ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const c //TODO: we can't convert compile-time errors to exceptions yet??? if (EG(current_execute_data) && !CG(in_compilation)) { - // %S is used for zend_string pointers by smart str printing, but normally - // is for wide character strings and so compilers complain if this is inline - // Use "%S" so that the message can contain null bytes. - const char *format = "%S"; - zend_throw_exception_ex(exception_ce, 0, format, message); + zend_throw_exception_ex(exception_ce, 0, "%pS", message); } else { - zend_error_noreturn(E_ERROR, "%s", ZSTR_VAL(message)); + zend_error_noreturn(E_ERROR, "%pS", message); } zend_string_release(message); @@ -1857,12 +1853,12 @@ ZEND_API ZEND_COLD void zend_illegal_container_offset(const zend_string *contain if (zend_string_equals(container, ZSTR_KNOWN(ZEND_STR_STRING))) { zend_throw_error(NULL, "Cannot unset string offsets"); } else { - zend_type_error("Cannot unset offset of type %s on %s", zend_zval_type_name(offset), ZSTR_VAL(container)); + zend_type_error("Cannot unset offset of type %s on %pS", zend_zval_type_name(offset), container); } return; default: - zend_type_error("Cannot access offset of type %s on %s", - zend_zval_type_name(offset), ZSTR_VAL(container)); + zend_type_error("Cannot access offset of type %s on %pS", + zend_zval_type_name(offset), container); return; } } @@ -1870,12 +1866,11 @@ ZEND_API ZEND_COLD void zend_illegal_container_offset(const zend_string *contain ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) /* {{{ */ { va_list va; - char *message = NULL; va_start(va, format); - zend_vspprintf(&message, 0, format, va); - zend_throw_exception(zend_ce_type_error, message, 0); - efree(message); + zend_string *message = zend_vstrpprintf(0, format, va); + zend_throw_exception_ex(zend_ce_type_error, 0, "%pS", message); + zend_string_release(message); va_end(va); } /* }}} */ diff --git a/Zend/zend_API.c b/Zend/zend_API.c index de3570c5e848..dd8421cf2c3b 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -89,7 +89,7 @@ ZEND_API ZEND_COLD void zend_wrong_property_read(const zval *object, zval *prope { zend_string *tmp_property_name; zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name); - zend_error(E_WARNING, "Attempt to read property \"%s\" on %s", ZSTR_VAL(property_name), zend_zval_value_name(object)); + zend_error(E_WARNING, "Attempt to read property \"%pS\" on %s", property_name, zend_zval_value_name(object)); zend_tmp_string_release(tmp_property_name); } @@ -201,7 +201,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_none_error(void) /* uint32_t num_args = ZEND_CALL_NUM_ARGS(EG(current_execute_data)); zend_string *func_name = get_active_function_or_method_name(); - zend_argument_count_error("%s() expects exactly 0 arguments, %" PRIu32 " given", ZSTR_VAL(func_name), num_args); + zend_argument_count_error("%pS() expects exactly 0 arguments, %" PRIu32 " given", func_name, num_args); zend_string_release(func_name); } @@ -213,8 +213,8 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(uint32_t zend_string *func_name = get_active_function_or_method_name(); zend_argument_count_error( - "%s() expects %s %d argument%s, %d given", - ZSTR_VAL(func_name), + "%pS() expects %s %d argument%s, %d given", + func_name, min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most", num_args < min_num_args ? min_num_args : max_num_args, (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s", @@ -389,8 +389,8 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_error_variadic( arg_name = get_function_arg_name(function, arg_num); zend_vspprintf(&message, 0, format, va); - zend_throw_error(error_ce, "%s(): Argument #%d%s%s%s %s", - ZSTR_VAL(func_name), arg_num, + zend_throw_error(error_ce, "%pS(): Argument #%d%s%s%s %s", + func_name, arg_num, arg_name ? " ($" : "", arg_name ? arg_name : "", arg_name ? ")" : "", message ); efree(message); @@ -467,14 +467,14 @@ ZEND_API ZEND_COLD void zend_argument_must_not_be_empty_error(uint32_t arg_num) ZEND_API ZEND_COLD void zend_class_redeclaration_error_ex(int type, zend_string *new_name, const zend_class_entry *old_ce) { if (old_ce->type == ZEND_INTERNAL_CLASS) { - zend_error(type, "Cannot redeclare %s %s", + zend_error(type, "Cannot redeclare %s %pS", zend_get_object_type(old_ce), - ZSTR_VAL(new_name)); + new_name); } else { - zend_error(type, "Cannot redeclare %s %s (previously declared in %s:%d)", + zend_error(type, "Cannot redeclare %s %pS (previously declared in %pS:%d)", zend_get_object_type(old_ce), - ZSTR_VAL(new_name), - ZSTR_VAL(old_ce->info.user.filename), + new_name, + old_ce->info.user.filename, old_ce->info.user.line_start); } } @@ -502,13 +502,13 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **p *pce = zend_lookup_class(class_name); if (ce_base) { if ((!*pce || !instanceof_function(*pce, ce_base))) { - zend_argument_type_error(num, "must be a class name derived from %s, %s given", ZSTR_VAL(ce_base->name), ZSTR_VAL(class_name)); + zend_argument_type_error(num, "must be a class name derived from %pS, %pS given", ce_base->name, class_name); *pce = NULL; return 0; } } if (!*pce) { - zend_argument_type_error(num, "must be a valid class name, %s given", ZSTR_VAL(class_name)); + zend_argument_type_error(num, "must be a valid class name, %pS given", class_name); return 0; } return 1; @@ -533,8 +533,8 @@ static ZEND_COLD bool zend_null_arg_deprecated(const char *fallback_type, uint32 zend_string *type_str = zend_type_to_string(arg_info->type); const char *type = type_str ? ZSTR_VAL(type_str) : fallback_type; zend_error(E_DEPRECATED, - "%s(): Passing null to parameter #%" PRIu32 "%s%s%s of type %s is deprecated", - ZSTR_VAL(func_name), arg_num, + "%pS(): Passing null to parameter #%" PRIu32 "%s%s%s of type %s is deprecated", + func_name, arg_num, arg_name ? " ($" : "", arg_name ? arg_name : "", arg_name ? ")" : "", type); zend_string_release(func_name); @@ -1006,7 +1006,7 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec if (!zend_parse_arg_object(arg, p, ce, check_null)) { if (ce) { if (check_null) { - zend_spprintf(error, 0, "must be of type ?%s, %s given", ZSTR_VAL(ce->name), zend_zval_value_name(arg)); + zend_spprintf(error, 0, "must be of type ?%pS, %s given", ce->name, zend_zval_value_name(arg)); return ""; } else { return ZSTR_VAL(ce->name); @@ -1039,15 +1039,15 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec } if (ce_base) { if ((!*pce || !instanceof_function(*pce, ce_base))) { - zend_spprintf(error, 0, "must be a class name derived from %s%s, %s given", - ZSTR_VAL(ce_base->name), check_null ? " or null" : "", Z_STRVAL_P(arg)); + zend_spprintf(error, 0, "must be a class name derived from %pS%s, %pS given", + ce_base->name, check_null ? " or null" : "", Z_STR_P(arg)); *pce = NULL; return ""; } } if (!*pce) { - zend_spprintf(error, 0, "must be a valid class name%s, %s given", - check_null ? " or null" : "", Z_STRVAL_P(arg)); + zend_spprintf(error, 0, "must be a valid class name%s, %pS given", + check_null ? " or null" : "", Z_STR_P(arg)); return ""; } break; @@ -1145,9 +1145,9 @@ static ZEND_COLD void zend_parse_parameters_debug_error(const char *msg) { const zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; - zend_error_noreturn(E_CORE_ERROR, "%s%s%s(): %s", + zend_error_noreturn(E_CORE_ERROR, "%s%s%pS(): %s", class_name, class_name[0] ? "::" : "", - ZSTR_VAL(active_function->common.function_name), msg); + active_function->common.function_name, msg); } static zend_result zend_parse_va_args(uint32_t num_args, const char *type_spec, va_list *va, int flags) /* {{{ */ @@ -1232,8 +1232,8 @@ static zend_result zend_parse_va_args(uint32_t num_args, const char *type_spec, if (!(flags & ZEND_PARSE_PARAMS_QUIET)) { zend_string *func_name = get_active_function_or_method_name(); - zend_argument_count_error("%s() expects %s %d argument%s, %d given", - ZSTR_VAL(func_name), + zend_argument_count_error("%pS() expects %s %d argument%s, %d given", + func_name, min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most", num_args < min_num_args ? min_num_args : max_num_args, (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s", @@ -1349,8 +1349,8 @@ ZEND_API zend_result zend_parse_method_parameters(uint32_t num_args, zval *this_ *object = this_ptr; if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce)) { - zend_error_noreturn(E_CORE_ERROR, "%s::%s() must be derived from %s::%s()", - ZSTR_VAL(Z_OBJCE_P(this_ptr)->name), get_active_function_name(), ZSTR_VAL(ce->name), get_active_function_name()); + zend_error_noreturn(E_CORE_ERROR, "%pS::%s() must be derived from %pS::%s()", + Z_OBJCE_P(this_ptr)->name, get_active_function_name(), ce->name, get_active_function_name()); } retval = zend_parse_va_args(num_args, p, &va, flags); @@ -1382,8 +1382,8 @@ ZEND_API zend_result zend_parse_method_parameters_ex(int flags, uint32_t num_arg if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce)) { if (!(flags & ZEND_PARSE_PARAMS_QUIET)) { - zend_error_noreturn(E_CORE_ERROR, "%s::%s() must be derived from %s::%s()", - ZSTR_VAL(ce->name), get_active_function_name(), ZSTR_VAL(Z_OBJCE_P(this_ptr)->name), get_active_function_name()); + zend_error_noreturn(E_CORE_ERROR, "%pS::%s() must be derived from %pS::%s()", + ce->name, get_active_function_name(), Z_OBJCE_P(this_ptr)->name, get_active_function_name()); } va_end(va); return FAILURE; @@ -1787,12 +1787,12 @@ ZEND_API void object_properties_load(zend_object *object, const HashTable *prope } } else { if (UNEXPECTED(object->ce->ce_flags & ZEND_ACC_NO_DYNAMIC_PROPERTIES)) { - zend_throw_error(NULL, "Cannot create dynamic property %s::$%s", - ZSTR_VAL(object->ce->name), property_info != ZEND_WRONG_PROPERTY_INFO ? zend_get_unmangled_property_name(key): ""); + zend_throw_error(NULL, "Cannot create dynamic property %pS::$%s", + object->ce->name, property_info != ZEND_WRONG_PROPERTY_INFO ? zend_get_unmangled_property_name(key): ""); return; } else if (!(object->ce->ce_flags & ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES)) { - zend_error(E_DEPRECATED, "Creation of dynamic property %s::$%s is deprecated", - ZSTR_VAL(object->ce->name), property_info != ZEND_WRONG_PROPERTY_INFO ? zend_get_unmangled_property_name(key): ""); + zend_error(E_DEPRECATED, "Creation of dynamic property %pS::$%s is deprecated", + object->ce->name, property_info != ZEND_WRONG_PROPERTY_INFO ? zend_get_unmangled_property_name(key): ""); } prop = zend_hash_update(zend_std_get_properties_ex(object), key, prop); @@ -1800,11 +1800,11 @@ ZEND_API void object_properties_load(zend_object *object, const HashTable *prope } } else { if (UNEXPECTED(object->ce->ce_flags & ZEND_ACC_NO_DYNAMIC_PROPERTIES)) { - zend_throw_error(NULL, "Cannot create dynamic property %s::$" ZEND_LONG_FMT, ZSTR_VAL(object->ce->name), h); + zend_throw_error(NULL, "Cannot create dynamic property %pS::$" ZEND_LONG_FMT, object->ce->name, h); return; } else if (!(object->ce->ce_flags & ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES)) { - zend_error(E_DEPRECATED, "Creation of dynamic property %s::$" ZEND_LONG_FMT " is deprecated", - ZSTR_VAL(object->ce->name), h); + zend_error(E_DEPRECATED, "Creation of dynamic property %pS::$" ZEND_LONG_FMT " is deprecated", + object->ce->name, h); } prop = zend_hash_index_update(zend_std_get_properties_ex(object), h, prop); @@ -1822,14 +1822,14 @@ static zend_always_inline zend_result _object_and_properties_init(zval *arg, zen { if (UNEXPECTED(class_type->ce_flags & ZEND_ACC_UNINSTANTIABLE)) { if (class_type->ce_flags & ZEND_ACC_INTERFACE) { - zend_throw_error(NULL, "Cannot instantiate interface %s", ZSTR_VAL(class_type->name)); + zend_throw_error(NULL, "Cannot instantiate interface %pS", class_type->name); } else if (class_type->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot instantiate trait %s", ZSTR_VAL(class_type->name)); + zend_throw_error(NULL, "Cannot instantiate trait %pS", class_type->name); } else if (class_type->ce_flags & ZEND_ACC_ENUM) { - zend_throw_error(NULL, "Cannot instantiate enum %s", ZSTR_VAL(class_type->name)); + zend_throw_error(NULL, "Cannot instantiate enum %pS", class_type->name); } else { ZEND_ASSERT(class_type->ce_flags & (ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)); - zend_throw_error(NULL, "Cannot instantiate abstract class %s", ZSTR_VAL(class_type->name)); + zend_throw_error(NULL, "Cannot instantiate abstract class %pS", class_type->name); } ZVAL_NULL(arg); Z_OBJ_P(arg) = NULL; @@ -1903,7 +1903,7 @@ ZEND_API zend_result object_init_with_constructor(zval *arg, zend_class_entry *c zend_string *arg_name = NULL; zend_hash_get_current_key(named_params, &arg_name, /* num_index */ NULL); ZEND_ASSERT(arg_name != NULL); - zend_throw_error(NULL, "Unknown named parameter $%s", ZSTR_VAL(arg_name)); + zend_throw_error(NULL, "Unknown named parameter $%pS", arg_name); /* Do not call destructor, free object, and set arg to IS_UNDEF */ zend_object_store_ctor_failed(obj); zval_ptr_dtor(arg); @@ -2685,21 +2685,21 @@ static void zend_check_magic_method_args( { if (fptr->common.num_args != num_args) { if (num_args == 0) { - zend_error(error_type, "Method %s::%s() cannot take arguments", - ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name)); + zend_error(error_type, "Method %pS::%pS() cannot take arguments", + ce->name, fptr->common.function_name); } else if (num_args == 1) { - zend_error(error_type, "Method %s::%s() must take exactly 1 argument", - ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name)); + zend_error(error_type, "Method %pS::%pS() must take exactly 1 argument", + ce->name, fptr->common.function_name); } else { - zend_error(error_type, "Method %s::%s() must take exactly %" PRIu32 " arguments", - ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name), num_args); + zend_error(error_type, "Method %pS::%pS() must take exactly %" PRIu32 " arguments", + ce->name, fptr->common.function_name, num_args); } return; } for (uint32_t i = 0; i < num_args; i++) { if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(fptr, i + 1)) { - zend_error(error_type, "Method %s::%s() cannot take arguments by reference", - ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name)); + zend_error(error_type, "Method %pS::%pS() cannot take arguments by reference", + ce->name, fptr->common.function_name); return; } } @@ -2711,10 +2711,10 @@ static void zend_check_magic_method_arg_type(uint32_t arg_num, const zend_class_ ZEND_TYPE_IS_SET(fptr->common.arg_info[arg_num].type) && !(ZEND_TYPE_FULL_MASK(fptr->common.arg_info[arg_num].type) & arg_type) ) { - zend_error(error_type, "%s::%s(): Parameter #%d ($%s) must be of type %s when declared", - ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name), - arg_num + 1, ZSTR_VAL(fptr->common.arg_info[arg_num].name), - ZSTR_VAL(zend_type_to_string((zend_type) ZEND_TYPE_INIT_MASK(arg_type)))); + zend_error(error_type, "%pS::%pS(): Parameter #%d ($%pS) must be of type %pS when declared", + ce->name, fptr->common.function_name, + arg_num + 1, fptr->common.arg_info[arg_num].name, + zend_type_to_string((zend_type) ZEND_TYPE_INIT_MASK(arg_type))); } } @@ -2722,7 +2722,7 @@ static void zend_check_magic_method_return_type(const zend_class_entry *ce, cons { if (return_type == MAY_BE_VOID) { if (fptr->common.fn_flags & ZEND_ACC_NODISCARD) { - zend_error_noreturn(error_type, "Method %s::%s cannot be #[\\NoDiscard]", ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name)); + zend_error_noreturn(error_type, "Method %pS::%pS cannot be #[\\NoDiscard]", ce->name, fptr->common.function_name); } } @@ -2744,9 +2744,9 @@ static void zend_check_magic_method_return_type(const zend_class_entry *ce, cons } if (extra_types || (is_complex_type && return_type != MAY_BE_OBJECT)) { - zend_error(error_type, "%s::%s(): Return type must be %s when declared", - ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name), - ZSTR_VAL(zend_type_to_string((zend_type) ZEND_TYPE_INIT_MASK(return_type)))); + zend_error(error_type, "%pS::%pS(): Return type must be %pS when declared", + ce->name, fptr->common.function_name, + zend_type_to_string((zend_type) ZEND_TYPE_INIT_MASK(return_type))); } } @@ -2754,8 +2754,8 @@ static void zend_check_magic_method_non_static( const zend_class_entry *ce, const zend_function *fptr, int error_type) { if (fptr->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Method %s::%s() cannot be static", - ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name)); + zend_error(error_type, "Method %pS::%pS() cannot be static", + ce->name, fptr->common.function_name); } } @@ -2763,8 +2763,8 @@ static void zend_check_magic_method_static( const zend_class_entry *ce, const zend_function *fptr, int error_type) { if (!(fptr->common.fn_flags & ZEND_ACC_STATIC)) { - zend_error(error_type, "Method %s::%s() must be static", - ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name)); + zend_error(error_type, "Method %pS::%pS() must be static", + ce->name, fptr->common.function_name); } } @@ -2773,8 +2773,8 @@ static void zend_check_magic_method_public( { // TODO: Remove this warning after adding proper visibility handling. if (!(fptr->common.fn_flags & ZEND_ACC_PUBLIC)) { - zend_error(E_WARNING, "The magic method %s::%s() must have public visibility", - ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name)); + zend_error(E_WARNING, "The magic method %pS::%pS() must have public visibility", + ce->name, fptr->common.function_name); } } @@ -2782,12 +2782,12 @@ static void zend_check_magic_method_no_return_type( const zend_class_entry *ce, const zend_function *fptr, int error_type) { if (fptr->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { - zend_error_noreturn(error_type, "Method %s::%s() cannot declare a return type", - ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name)); + zend_error_noreturn(error_type, "Method %pS::%pS() cannot declare a return type", + ce->name, fptr->common.function_name); } if (fptr->common.fn_flags & ZEND_ACC_NODISCARD) { - zend_error_noreturn(error_type, "Method %s::%s cannot be #[\\NoDiscard]", ZSTR_VAL(ce->name), ZSTR_VAL(fptr->common.function_name)); + zend_error_noreturn(error_type, "Method %pS::%pS cannot be #[\\NoDiscard]", ce->name, fptr->common.function_name); } } @@ -2855,8 +2855,8 @@ ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, zend_check_magic_method_public(ce, fptr); zend_check_magic_method_return_type(ce, fptr, error_type, (MAY_BE_ARRAY | MAY_BE_NULL)); if ((fptr->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) && ZEND_TYPE_PURE_MASK(fptr->common.arg_info[-1].type) & MAY_BE_NULL) { - zend_error(E_DEPRECATED, "Returning null from %s::__debugInfo() is deprecated, make the return type non-nullable and return an empty array instead", - ZSTR_VAL(ce->name)); + zend_error(E_DEPRECATED, "Returning null from %pS::__debugInfo() is deprecated, make the return type non-nullable and return an empty array instead", + ce->name); } } else if (zend_string_equals_literal(lcname, ZEND_SERIALIZE_FUNC_NAME)) { zend_check_magic_method_args(0, ce, fptr, error_type); @@ -3090,7 +3090,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend if (ptr->flags & UINT32_MAX) { if (!(ptr->flags & ZEND_ACC_PPP_MASK)) { if (ptr->flags != ZEND_ACC_DEPRECATED && scope) { - zend_error(error_type, "Invalid access level for %s::%s() - access must be exactly one of public, protected or private", ZSTR_VAL(scope->name), ptr->fname); + zend_error(error_type, "Invalid access level for %pS::%s() - access must be exactly one of public, protected or private", scope->name, ptr->fname); } internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags; } else { @@ -3142,8 +3142,8 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend * interface. */ if (scope && zend_string_equals_literal_ci(internal_function->function_name, ZEND_TOSTRING_FUNC_LCNAME) && !(internal_function->fn_flags & ZEND_ACC_HAS_RETURN_TYPE)) { - zend_error(E_CORE_WARNING, "%s::__toString() implemented without string return type", - ZSTR_VAL(scope->name)); + zend_error(E_CORE_WARNING, "%pS::__toString() implemented without string return type", + scope->name); internal_arg_info = (zend_internal_arg_info *) arg_info_toString + 1; internal_function->fn_flags |= ZEND_ACC_HAS_RETURN_TYPE; internal_function->num_args = internal_function->required_num_args = 0; @@ -3165,7 +3165,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend } } else { if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) { - zend_error(error_type, "Interface %s cannot contain non abstract method %s()", ZSTR_VAL(scope->name), ptr->fname); + zend_error(error_type, "Interface %pS cannot contain non abstract method %s()", scope->name, ptr->fname); return FAILURE; } if (!internal_function->handler) { @@ -3823,6 +3823,11 @@ ZEND_API void zend_release_fcall_info_cache(zend_fcall_info_cache *fcc) { static zend_always_inline bool zend_is_method_callable(zend_string *callable, const zend_execute_data *frame, zend_fcall_info_cache *fcc, bool strict_class, char **error, bool suppress_deprecation) /* {{{ */ { + // In a number of places, zend_string pointers are read and included in + // the error. NOT using `%pS` to include null bytes in the results, since the + // `error` out parameter is a char pointer; if null bytes were kept then + // they would be treated as the end of the overall error message. + // TODO: make the error pointer be a zend_string pointer. zend_class_entry *ce_org = fcc->calling_scope; bool retval = false; zend_string *mname; @@ -3885,13 +3890,15 @@ static zend_always_inline bool zend_is_method_callable(zend_string *callable, co ftable = &fcc->calling_scope->function_table; if (ce_org && !instanceof_function(ce_org, fcc->calling_scope)) { + // NOT using %pS, see above if (error) zend_spprintf(error, 0, "class %s is not a subclass of %s", ZSTR_VAL(ce_org->name), ZSTR_VAL(fcc->calling_scope->name)); return 0; } if (ce_org && !suppress_deprecation) { + // Can use %pS here since this message isn't stored in the `error` zend_error(E_DEPRECATED, - "Callables of the form [\"%s\", \"%s\"] are deprecated", - ZSTR_VAL(ce_org->name), ZSTR_VAL(callable)); + "Callables of the form [\"%pS\", \"%pS\"] are deprecated", + ce_org->name, callable); } mname = zend_string_init(ZSTR_VAL(callable) + class_name_len + 2, mlen, 0); } else if (ce_org) { @@ -3903,6 +3910,7 @@ static zend_always_inline bool zend_is_method_callable(zend_string *callable, co } else { /* We already checked for plain function before. */ if (error) { + // NOT using %pS, see above zend_spprintf(error, 0, "function \"%s\" not found or invalid function name", ZSTR_VAL(callable)); } return 0; @@ -3993,11 +4001,13 @@ static zend_always_inline bool zend_is_method_callable(zend_string *callable, co if (fcc->function_handler->common.fn_flags & ZEND_ACC_ABSTRACT) { retval = false; if (error) { + // NOT using %pS, see above zend_spprintf(error, 0, "cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); } } else if (!fcc->object && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) { retval = false; if (error) { + // NOT using %pS, see above zend_spprintf(error, 0, "non-static method %s::%s() cannot be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); } } @@ -4010,6 +4020,7 @@ static zend_always_inline bool zend_is_method_callable(zend_string *callable, co if (*error) { efree(*error); } + // NOT using %pS, see above zend_spprintf(error, 0, "cannot access %s method %s::%s()", zend_visibility_string(fcc->function_handler->common.fn_flags), ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); } retval = false; @@ -4018,8 +4029,10 @@ static zend_always_inline bool zend_is_method_callable(zend_string *callable, co } } else if (error) { if (fcc->calling_scope) { + // NOT using %pS, see above zend_spprintf(error, 0, "class %s does not have a method \"%s\"", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(mname)); } else { + // NOT using %pS, see above zend_spprintf(error, 0, "function %s() does not exist", ZSTR_VAL(mname)); } } @@ -4506,15 +4519,15 @@ ZEND_API zend_property_info *zend_declare_typed_property(zend_class_entry *ce, z } else if (UNEXPECTED(access_type & ZEND_ACC_PPP_SET_MASK)) { if (!ZEND_TYPE_IS_SET(type)) { zend_error_noreturn(ce->type == ZEND_INTERNAL_CLASS ? E_CORE_ERROR : E_COMPILE_ERROR, - "Property with asymmetric visibility %s::$%s must have type", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + "Property with asymmetric visibility %pS::$%pS must have type", + ce->name, name); } uint32_t get_visibility = zend_visibility_to_set_visibility(access_type & ZEND_ACC_PPP_MASK); uint32_t set_visibility = access_type & ZEND_ACC_PPP_SET_MASK; if (get_visibility > set_visibility) { zend_error_noreturn(ce->type == ZEND_INTERNAL_CLASS ? E_CORE_ERROR : E_COMPILE_ERROR, - "Visibility of property %s::$%s must not be weaker than set visibility", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + "Visibility of property %pS::$%pS must not be weaker than set visibility", + ce->name, name); } /* Remove equivalent set visibility. */ if (((access_type & (ZEND_ACC_PUBLIC|ZEND_ACC_PUBLIC_SET)) == (ZEND_ACC_PUBLIC|ZEND_ACC_PUBLIC_SET)) @@ -4826,7 +4839,7 @@ ZEND_API zend_class_constant *zend_declare_typed_class_constant(zend_class_entry if (ce->ce_flags & ZEND_ACC_INTERFACE) { if (!(flags & ZEND_ACC_PUBLIC)) { - zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface constant %s::%s must be public", ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface constant %pS::%pS must be public", ce->name, name); } } @@ -4864,7 +4877,7 @@ ZEND_API zend_class_constant *zend_declare_typed_class_constant(zend_class_entry if (!zend_hash_add_ptr(&ce->constants_table, name, c)) { zend_error_noreturn(ce->type == ZEND_INTERNAL_CLASS ? E_CORE_ERROR : E_COMPILE_ERROR, - "Cannot redefine class constant %s::%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); + "Cannot redefine class constant %pS::%pS", ce->name, name); } return c; @@ -5344,7 +5357,7 @@ ZEND_API zend_result zend_get_default_from_internal_arg_info( } #if 0 - fprintf(stderr, "Evaluating %s via AST\n", ZSTR_VAL(default_value)); + fprintf(stderr, "Evaluating %pS via AST\n", default_value); #endif return get_default_via_ast(default_value_zval, ZSTR_VAL(default_value)); } diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 4b070d9d5d58..e9ec16bf623f 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1164,8 +1164,8 @@ static zend_result ZEND_FASTCALL zend_ast_evaluate_inner( if (name) { if (!zend_hash_add(args, name, &arg)) { zend_throw_error(NULL, - "Named parameter $%s overwrites previous argument", - ZSTR_VAL(name)); + "Named parameter $%pS overwrites previous argument", + name); zend_array_destroy(args); zval_ptr_dtor(result); return FAILURE; @@ -1252,7 +1252,7 @@ static zend_result ZEND_FASTCALL zend_ast_evaluate_inner( } if (!fptr) { - zend_throw_error(NULL, "Call to undefined function %s()", ZSTR_VAL(function_name)); + zend_throw_error(NULL, "Call to undefined function %pS()", function_name); return FAILURE; } @@ -1308,9 +1308,9 @@ static zend_result ZEND_FASTCALL zend_ast_evaluate_inner( return FAILURE; } else if (fptr->common.scope->ce_flags & ZEND_ACC_TRAIT) { zend_error(E_DEPRECATED, - "Calling static trait method %s::%s is deprecated, " + "Calling static trait method %pS::%pS is deprecated, " "it should only be called on a class using the trait", - ZSTR_VAL(fptr->common.scope->name), ZSTR_VAL(fptr->common.function_name)); + fptr->common.scope->name, fptr->common.function_name); if (EG(exception)) { return FAILURE; } diff --git a/Zend/zend_attributes.c b/Zend/zend_attributes.c index 71f0d788e921..957104596ea2 100644 --- a/Zend/zend_attributes.c +++ b/Zend/zend_attributes.c @@ -75,16 +75,16 @@ static zend_string *validate_allow_dynamic_properties( ZEND_ASSERT(scope != NULL); const char *msg = NULL; if (scope->ce_flags & ZEND_ACC_TRAIT) { - msg = "Cannot apply #[\\AllowDynamicProperties] to trait %s"; + msg = "Cannot apply #[\\AllowDynamicProperties] to trait %pS"; } else if (scope->ce_flags & ZEND_ACC_INTERFACE) { - msg = "Cannot apply #[\\AllowDynamicProperties] to interface %s"; + msg = "Cannot apply #[\\AllowDynamicProperties] to interface %pS"; } else if (scope->ce_flags & ZEND_ACC_READONLY_CLASS) { - msg = "Cannot apply #[\\AllowDynamicProperties] to readonly class %s"; + msg = "Cannot apply #[\\AllowDynamicProperties] to readonly class %pS"; } else if (scope->ce_flags & ZEND_ACC_ENUM) { - msg = "Cannot apply #[\\AllowDynamicProperties] to enum %s"; + msg = "Cannot apply #[\\AllowDynamicProperties] to enum %pS"; } if (msg != NULL) { - return zend_strpprintf(0, msg, ZSTR_VAL(scope->name)); + return zend_strpprintf(0, msg, scope->name); } scope->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES; return NULL; @@ -95,16 +95,16 @@ static zend_string *validate_attribute( { const char *msg = NULL; if (scope->ce_flags & ZEND_ACC_TRAIT) { - msg = "Cannot apply #[\\Attribute] to trait %s"; + msg = "Cannot apply #[\\Attribute] to trait %pS"; } else if (scope->ce_flags & ZEND_ACC_INTERFACE) { - msg = "Cannot apply #[\\Attribute] to interface %s"; + msg = "Cannot apply #[\\Attribute] to interface %pS"; } else if (scope->ce_flags & ZEND_ACC_ENUM) { - msg = "Cannot apply #[\\Attribute] to enum %s"; + msg = "Cannot apply #[\\Attribute] to enum %pS"; } else if (scope->ce_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS) { - msg = "Cannot apply #[\\Attribute] to abstract class %s"; + msg = "Cannot apply #[\\Attribute] to abstract class %pS"; } if (msg != NULL) { - return zend_strpprintf(0, msg, ZSTR_VAL(scope->name)); + return zend_strpprintf(0, msg, scope->name); } return NULL; } @@ -120,7 +120,7 @@ static zend_string *validate_deprecated( } if (!(scope->ce_flags & ZEND_ACC_TRAIT)) { const char *type = zend_get_object_type_case(scope, false); - return zend_strpprintf(0, "Cannot apply #[\\Deprecated] to %s %s", type, ZSTR_VAL(scope->name)); + return zend_strpprintf(0, "Cannot apply #[\\Deprecated] to %s %pS", type, scope->name); } scope->ce_flags |= ZEND_ACC_DEPRECATED; diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index ed0507e0500e..c0d65090926a 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -90,7 +90,7 @@ ZEND_FUNCTION(clone) const zend_function *clone = ce->clone; if (UNEXPECTED(zobj->handlers->clone_obj == NULL)) { - zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Trying to clone an uncloneable object of class %pS", ce->name); RETURN_THROWS(); } @@ -102,7 +102,7 @@ ZEND_FUNCTION(clone) zend_object *cloned; if (zend_hash_num_elements(with) > 0) { if (UNEXPECTED(!zobj->handlers->clone_obj_with)) { - zend_throw_error(NULL, "Cloning objects of class %s with updated properties is not supported", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cloning objects of class %pS with updated properties is not supported", ce->name); RETURN_THROWS(); } @@ -1208,7 +1208,7 @@ ZEND_FUNCTION(class_alias) RETURN_FALSE; } } else { - zend_error(E_WARNING, "Class \"%s\" not found", ZSTR_VAL(class_name)); + zend_error(E_WARNING, "Class \"%pS\" not found", class_name); RETURN_FALSE; } } diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 91f690c73ed0..96767787ac4a 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -105,10 +105,10 @@ static bool zend_valid_closure_binding( if (is_fake_closure && func->common.scope && !instanceof_function(Z_OBJCE_P(newthis), func->common.scope)) { /* Binding incompatible $this to an internal method is not supported. */ - zend_error(E_WARNING, "Cannot bind method %s::%s() to object of class %s, this will be an error in PHP 9", - ZSTR_VAL(func->common.scope->name), - ZSTR_VAL(func->common.function_name), - ZSTR_VAL(Z_OBJCE_P(newthis)->name)); + zend_error(E_WARNING, "Cannot bind method %pS::%pS() to object of class %pS, this will be an error in PHP 9", + func->common.scope->name, + func->common.function_name, + Z_OBJCE_P(newthis)->name); return false; } } else if (is_fake_closure && func->common.scope @@ -123,8 +123,8 @@ static bool zend_valid_closure_binding( if (scope && scope != func->common.scope && scope->type == ZEND_INTERNAL_CLASS) { /* rebinding to internal class is not allowed */ - zend_error(E_WARNING, "Cannot bind closure to scope of internal class %s, this will be an error in PHP 9", - ZSTR_VAL(scope->name)); + zend_error(E_WARNING, "Cannot bind closure to scope of internal class %pS, this will be an error in PHP 9", + scope->name); return false; } @@ -255,7 +255,7 @@ static zend_result do_closure_bind(zval *return_value, zval *zclosure, zval *new if (zend_string_equals(scope_str, ZSTR_KNOWN(ZEND_STR_STATIC))) { ce = closure->func.common.scope; } else if ((ce = zend_lookup_class(scope_str)) == NULL) { - zend_error(E_WARNING, "Class \"%s\" not found", ZSTR_VAL(scope_str)); + zend_error(E_WARNING, "Class \"%pS\" not found", scope_str); RETVAL_NULL(); return FAILURE; } @@ -743,9 +743,9 @@ static HashTable *zend_closure_get_debug_info(zend_object *object, int *is_temp) zend_string *name; zval info; ZEND_ASSERT(arg_info->name && "Argument should have name"); - name = zend_strpprintf(0, "%s$%s", + name = zend_strpprintf(0, "%s$%pS", ZEND_ARG_SEND_MODE(arg_info) ? "&" : "", - ZSTR_VAL(arg_info->name)); + arg_info->name); ZVAL_NEW_STR(&info, zend_strpprintf(0, "%s", i >= required ? "" : "")); zend_hash_update(Z_ARRVAL(val), name, &info); zend_string_release_ex(name, 0); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index a2f126fb101d..b6e51cfae625 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -180,8 +180,8 @@ static zend_brk_cont_element *get_next_brk_cont_element(void) static zend_string *zend_build_runtime_definition_key(zend_string *name, uint32_t start_lineno) /* {{{ */ { zend_string *filename = CG(active_op_array)->filename; - zend_string *result = zend_strpprintf(0, "%c%s%s:%" PRIu32 "$%" PRIx32, - '\0', ZSTR_VAL(name), ZSTR_VAL(filename), start_lineno, CG(rtd_key_counter)++); + zend_string *result = zend_strpprintf(0, "%c%pS%pS:%" PRIu32 "$%" PRIx32, + '\0', name, filename, start_lineno, CG(rtd_key_counter)++); return zend_new_interned_string(result); } /* }}} */ @@ -250,7 +250,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 \"%pS\" as %s as it is reserved", name, type); } if (zend_string_equals_literal(name, "_")) { zend_error(E_DEPRECATED, "Using \"_\" as %s is deprecated since 8.4", type); @@ -1175,11 +1175,11 @@ static zend_string *zend_resolve_class_name(zend_string *name, uint32_t type) /* if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(name)) { if (type == ZEND_NAME_FQ) { zend_error_noreturn(E_COMPILE_ERROR, - "'\\%s' is an invalid class name", ZSTR_VAL(name)); + "'\\%pS' is an invalid class name", name); } if (type == ZEND_NAME_RELATIVE) { zend_error_noreturn(E_COMPILE_ERROR, - "'namespace\\%s' is an invalid class name", ZSTR_VAL(name)); + "'namespace\\%pS' is an invalid class name", name); } ZEND_ASSERT(type == ZEND_NAME_NOT_FQ); return zend_string_copy(name); @@ -1195,7 +1195,7 @@ static zend_string *zend_resolve_class_name(zend_string *name, uint32_t type) /* name = zend_string_init(ZSTR_VAL(name) + 1, ZSTR_LEN(name) - 1, 0); if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(name)) { zend_error_noreturn(E_COMPILE_ERROR, - "'\\%s' is an invalid class name", ZSTR_VAL(name)); + "'\\%pS' is an invalid class name", name); } return name; } @@ -1299,13 +1299,13 @@ static zend_never_inline ZEND_COLD ZEND_NORETURN void do_bind_function_error(con old_function = Z_PTR_P(zv); if (old_function->type == ZEND_USER_FUNCTION && old_function->op_array.last > 0) { - zend_error_noreturn(error_level, "Cannot redeclare function %s() (previously declared in %s:%d)", - op_array ? ZSTR_VAL(op_array->function_name) : ZSTR_VAL(old_function->common.function_name), - ZSTR_VAL(old_function->op_array.filename), + zend_error_noreturn(error_level, "Cannot redeclare function %pS() (previously declared in %pS:%d)", + op_array ? op_array->function_name : old_function->common.function_name, + old_function->op_array.filename, old_function->op_array.line_start); } else { - zend_error_noreturn(error_level, "Cannot redeclare function %s()", - op_array ? ZSTR_VAL(op_array->function_name) : ZSTR_VAL(old_function->common.function_name)); + zend_error_noreturn(error_level, "Cannot redeclare function %pS()", + op_array ? op_array->function_name : old_function->common.function_name); } } @@ -1576,8 +1576,8 @@ static void zend_mark_function_as_generator(void) /* {{{ */ if (!valid_type) { zend_string *str = zend_type_to_string(return_type); zend_error_noreturn(E_COMPILE_ERROR, - "Generator return type must be a supertype of Generator, %s given", - ZSTR_VAL(str)); + "Generator return type must be a supertype of Generator, %pS given", + str); } } @@ -1784,8 +1784,8 @@ 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", - ZSTR_VAL(class_name), type); + "Cannot use \"%pS\" as %s, as it is reserved", + class_name, type); } return zend_resolve_class_name(class_name, ast->attr); } @@ -5530,18 +5530,18 @@ static bool zend_compile_parent_property_hook_call(znode *result, const zend_ast const zend_string *prop_info_name = CG(context).active_property_info_name; if (!prop_info_name) { - zend_error_noreturn(E_COMPILE_ERROR, "Must not use parent::$%s::%s() outside a property hook", - ZSTR_VAL(property_name), ZSTR_VAL(hook_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Must not use parent::$%pS::%pS() outside a property hook", + property_name, hook_name); } const char *unmangled_prop_name = zend_get_unmangled_property_name(prop_info_name); if (!zend_string_equals_cstr(property_name, unmangled_prop_name, strlen(unmangled_prop_name))) { - zend_error_noreturn(E_COMPILE_ERROR, "Must not use parent::$%s::%s() in a different property ($%s)", - ZSTR_VAL(property_name), ZSTR_VAL(hook_name), unmangled_prop_name); + zend_error_noreturn(E_COMPILE_ERROR, "Must not use parent::$%pS::%pS() in a different property ($%s)", + property_name, hook_name, unmangled_prop_name); } if (hook_kind != CG(context).active_property_hook_kind) { - zend_error_noreturn(E_COMPILE_ERROR, "Must not use parent::$%s::%s() in a different property hook (%s)", - ZSTR_VAL(property_name), ZSTR_VAL(hook_name), zend_get_cstring_from_property_hook_kind(CG(context).active_property_hook_kind)); + zend_error_noreturn(E_COMPILE_ERROR, "Must not use parent::$%pS::%pS() in a different property hook (%s)", + property_name, hook_name, zend_get_cstring_from_property_hook_kind(CG(context).active_property_hook_kind)); } zend_op *opline = get_next_op(); @@ -6332,7 +6332,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline) /* {{{ */ CG(in_compilation) = 1; CG(active_op_array) = op_array; CG(zend_lineno) = opline->lineno; - zend_error_noreturn(E_COMPILE_ERROR, "'goto' to undefined label '%s'", Z_STRVAL_P(label)); + zend_error_noreturn(E_COMPILE_ERROR, "'goto' to undefined label '%pS'", Z_STR_P(label)); } zval_ptr_dtor_str(label); @@ -6410,7 +6410,7 @@ static void zend_compile_label(const zend_ast *ast) /* {{{ */ dest.opline_num = get_next_op_number(); if (!zend_hash_add_mem(CG(context).labels, label, &dest, sizeof(zend_label))) { - zend_error_noreturn(E_COMPILE_ERROR, "Label '%s' already defined", ZSTR_VAL(label)); + zend_error_noreturn(E_COMPILE_ERROR, "Label '%pS' already defined", label); } } /* }}} */ @@ -7447,7 +7447,7 @@ bool zend_handle_encoding_declaration(zend_ast *ast) /* {{{ */ new_encoding = zend_multibyte_fetch_encoding(ZSTR_VAL(encoding_name)); if (!new_encoding) { - zend_error(E_COMPILE_WARNING, "Unsupported encoding [%s]", ZSTR_VAL(encoding_name)); + zend_error(E_COMPILE_WARNING, "Unsupported encoding [%pS]", encoding_name); } else { old_input_filter = LANG_SCNG(input_filter); old_encoding = LANG_SCNG(script_encoding); @@ -7508,7 +7508,7 @@ static void zend_compile_declare(const zend_ast *ast) /* {{{ */ zend_string *name = zend_ast_get_str(name_ast); if ((*value_ast_ptr)->kind != ZEND_AST_ZVAL) { - zend_error_noreturn(E_COMPILE_ERROR, "declare(%s) value must be a literal", ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "declare(%pS) value must be a literal", name); } if (zend_string_equals_literal_ci(name, "ticks")) { @@ -7546,7 +7546,7 @@ static void zend_compile_declare(const zend_ast *ast) /* {{{ */ } } else { - zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", ZSTR_VAL(name)); + zend_error(E_COMPILE_WARNING, "Unsupported declare '%pS'", name); } } @@ -7610,8 +7610,8 @@ static zend_type zend_compile_single_typename(zend_ast *ast) if (type_code != 0) { if ((ast->attr & ZEND_NAME_NOT_FQ) != ZEND_NAME_NOT_FQ) { zend_error_noreturn(E_COMPILE_ERROR, - "Type declaration '%s' must be unqualified", - ZSTR_VAL(zend_string_tolower(type_name))); + "Type declaration '%pS' must be unqualified", + zend_string_tolower(type_name)); } /* Transform iterable into a type union alias */ @@ -7663,15 +7663,15 @@ static zend_type zend_compile_single_typename(zend_ast *ast) FC(current_namespace) ? " or import the class with \"use\"" : ""; if (correct_name) { zend_error(E_COMPILE_WARNING, - "\"%s\" will be interpreted as a class name. Did you mean \"%s\"? " - "Write \"\\%s\"%s to suppress this warning", - ZSTR_VAL(type_name), correct_name, ZSTR_VAL(class_name), extra); + "\"%pS\" will be interpreted as a class name. Did you mean \"%s\"? " + "Write \"\\%pS\"%s to suppress this warning", + type_name, correct_name, class_name, extra); } else { zend_error(E_COMPILE_WARNING, - "\"%s\" is not a supported builtin type " + "\"%pS\" is not a supported builtin type " "and will be interpreted as a class name. " - "Write \"\\%s\"%s to suppress this warning", - ZSTR_VAL(type_name), ZSTR_VAL(class_name), extra); + "Write \"\\%pS\"%s to suppress this warning", + type_name, class_name, extra); } } @@ -7723,11 +7723,11 @@ static void zend_are_intersection_types_redundant(const zend_type left_type, con larger_type_str = zend_type_to_string(right_type); } if (smaller_type_list->num_types == larger_type_list->num_types) { - zend_error_noreturn(E_COMPILE_ERROR, "Type %s is redundant with type %s", - ZSTR_VAL(smaller_type_str), ZSTR_VAL(larger_type_str)); + zend_error_noreturn(E_COMPILE_ERROR, "Type %pS is redundant with type %pS", + smaller_type_str, larger_type_str); } else { - zend_error_noreturn(E_COMPILE_ERROR, "Type %s is redundant as it is more restrictive than type %s", - ZSTR_VAL(larger_type_str), ZSTR_VAL(smaller_type_str)); + zend_error_noreturn(E_COMPILE_ERROR, "Type %pS is redundant as it is more restrictive than type %pS", + larger_type_str, smaller_type_str); } } } @@ -7742,8 +7742,8 @@ static void zend_is_intersection_type_redundant_by_single_type(const zend_type i if (zend_string_equals_ci(ZEND_TYPE_NAME(*single_intersection_type), ZEND_TYPE_NAME(single_type))) { zend_string *single_type_str = zend_type_to_string(single_type); zend_string *complete_type = zend_type_to_string(intersection_type); - zend_error_noreturn(E_COMPILE_ERROR, "Type %s is redundant as it is more restrictive than type %s", - ZSTR_VAL(complete_type), ZSTR_VAL(single_type_str)); + zend_error_noreturn(E_COMPILE_ERROR, "Type %pS is redundant as it is more restrictive than type %pS", + complete_type, single_type_str); } } ZEND_TYPE_FOREACH_END(); } @@ -7759,7 +7759,7 @@ static void zend_is_type_list_redundant_by_single_type(const zend_type_list *typ } if (zend_string_equals_ci(ZEND_TYPE_NAME(type_list->types[i]), ZEND_TYPE_NAME(type))) { zend_string *single_type_str = zend_type_to_string(type); - zend_error_noreturn(E_COMPILE_ERROR, "Duplicate type %s is redundant", ZSTR_VAL(single_type_str)); + zend_error_noreturn(E_COMPILE_ERROR, "Duplicate type %pS is redundant", single_type_str); } } } @@ -7838,7 +7838,7 @@ static zend_type zend_compile_typename_ex( zend_type overlap_type = ZEND_TYPE_INIT_MASK(type_mask_overlap); zend_string *overlap_type_str = zend_type_to_string(overlap_type); zend_error_noreturn(E_COMPILE_ERROR, - "Duplicate type %s is redundant", ZSTR_VAL(overlap_type_str)); + "Duplicate type %pS is redundant", overlap_type_str); } if ( ((type_mask & MAY_BE_TRUE) && (single_type_mask == MAY_BE_FALSE)) @@ -7890,8 +7890,8 @@ static zend_type zend_compile_typename_ex( ((!has_only_iterable_class && ZEND_TYPE_IS_COMPLEX(type)) || (type_mask & MAY_BE_STATIC))) { zend_string *type_str = zend_type_to_string(type); zend_error_noreturn(E_COMPILE_ERROR, - "Type %s contains both object and a class type, which is redundant", - ZSTR_VAL(type_str)); + "Type %pS contains both object and a class type, which is redundant", + type_str); } } else if (ast->kind == ZEND_AST_TYPE_INTERSECTION) { const zend_ast_list *list = zend_ast_get_list(ast); @@ -7913,13 +7913,13 @@ static zend_type zend_compile_typename_ex( if (ZEND_TYPE_IS_ITERABLE_FALLBACK(single_type)) { zend_string *standard_type_str = zend_type_to_string(single_type); zend_error_noreturn(E_COMPILE_ERROR, - "Type %s cannot be part of an intersection type", ZSTR_VAL(standard_type_str)); + "Type %pS cannot be part of an intersection type", standard_type_str); } /* An intersection of standard types cannot exist so invalidate it */ if (ZEND_TYPE_IS_ONLY_MASK(single_type)) { zend_string *standard_type_str = zend_type_to_string(single_type); zend_error_noreturn(E_COMPILE_ERROR, - "Type %s cannot be part of an intersection type", ZSTR_VAL(standard_type_str)); + "Type %pS cannot be part of an intersection type", standard_type_str); } /* Check for "self" and "parent" too */ if ( @@ -7927,7 +7927,7 @@ static zend_type zend_compile_typename_ex( || zend_string_equals_ci(ZEND_TYPE_NAME(single_type), ZSTR_KNOWN(ZEND_STR_PARENT)) ) { zend_error_noreturn(E_COMPILE_ERROR, - "Type %s cannot be part of an intersection type", ZSTR_VAL(ZEND_TYPE_NAME(single_type))); + "Type %pS cannot be part of an intersection type", ZEND_TYPE_NAME(single_type)); } /* Add type to the type list */ @@ -8086,8 +8086,8 @@ static void zend_compile_attributes( for (uint32_t k = 0; k < j; k++) { if (attr->args[k].name && zend_string_equals(attr->args[k].name, attr->args[j].name)) { - zend_error_noreturn(E_COMPILE_ERROR, "Duplicate named parameter $%s", - ZSTR_VAL(attr->args[j].name)); + zend_error_noreturn(E_COMPILE_ERROR, "Duplicate named parameter $%pS", + attr->args[j].name); } } } else if (uses_named_args) { @@ -8133,8 +8133,8 @@ static void zend_compile_attributes( zend_string *location = zend_get_attribute_target_names(target); zend_string *allowed = zend_get_attribute_target_names(config->flags); - zend_error_noreturn(E_ERROR, "Attribute \"%s\" cannot target %s (allowed targets: %s)", - ZSTR_VAL(attr->name), ZSTR_VAL(location), ZSTR_VAL(allowed) + zend_error_noreturn(E_ERROR, "Attribute \"%pS\" cannot target %pS (allowed targets: %pS)", + attr->name, location, allowed ); } run_validator = false; @@ -8142,7 +8142,7 @@ static void zend_compile_attributes( if (!(config->flags & ZEND_ATTRIBUTE_IS_REPEATABLE)) { if (zend_is_attribute_repeated(*attributes, attr)) { - zend_error_noreturn(E_ERROR, "Attribute \"%s\" must not be repeated", ZSTR_VAL(attr->name)); + zend_error_noreturn(E_ERROR, "Attribute \"%pS\" must not be repeated", attr->name); } } @@ -8151,7 +8151,7 @@ static void zend_compile_attributes( zend_string *error = config->validator(attr, target, CG(active_class_entry)); if (error != NULL) { if (delayed_target_validation == NULL) { - zend_error_noreturn(E_COMPILE_ERROR, "%s", ZSTR_VAL(error)); + zend_error_noreturn(E_COMPILE_ERROR, "%pS", error); } else { attr->validation_error = error; } @@ -8264,7 +8264,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32 if (ZEND_TYPE_CONTAINS_CODE(arg_infos[-1].type, IS_VOID) && (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE)) { zend_string *func_name = get_function_or_method_name((zend_function *) op_array); - zend_error(E_DEPRECATED, "%s(): Returning by reference from a void function is deprecated", ZSTR_VAL(func_name)); + zend_error(E_DEPRECATED, "%pS(): Returning by reference from a void function is deprecated", func_name); zend_string_release(func_name); } } else { @@ -8308,16 +8308,16 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32 zend_arg_info *arg_info; if (zend_is_auto_global(name)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %s", - ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %pS", + name); } var_node.op_type = IS_CV; var_node.u.op.var = lookup_cv(name); if (EX_VAR_TO_NUM(var_node.u.op.var) != i) { - zend_error_noreturn(E_COMPILE_ERROR, "Redefinition of parameter $%s", - ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Redefinition of parameter $%pS", + name); } else if (zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_THIS))) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as parameter"); } else if (zend_string_equals_literal(name, "http_response_header")) { @@ -8375,8 +8375,8 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32 if (forced_allow_nullable) { zend_string *func_name = get_function_or_method_name((zend_function *) op_array); zend_error(E_DEPRECATED, - "%s(): Implicitly marking parameter $%s as nullable is deprecated, the explicit nullable type " - "must be used instead", ZSTR_VAL(func_name), ZSTR_VAL(name)); + "%pS(): Implicitly marking parameter $%pS as nullable is deprecated, the explicit nullable type " + "must be used instead", func_name, name); zend_string_release(func_name); } @@ -8392,9 +8392,9 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32 && !zend_is_valid_default_value(arg_info->type, &default_node.u.constant)) { zend_string *type_str = zend_type_to_string(arg_info->type); zend_error_noreturn(E_COMPILE_ERROR, - "Cannot use %s as default value for parameter $%s of type %s", + "Cannot use %s as default value for parameter $%pS of type %pS", zend_get_type_by_const(default_type), - ZSTR_VAL(name), ZSTR_VAL(type_str)); + name, type_str); } } if (last_required_param != (uint32_t) -1 @@ -8406,9 +8406,9 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32 zend_string *func_name = get_function_or_method_name((zend_function *) op_array); zend_ast *required_param_ast = list->child[last_required_param]; zend_error(E_DEPRECATED, - "%s(): Optional parameter $%s declared before required parameter $%s " + "%pS(): Optional parameter $%pS declared before required parameter $%pS " "is implicitly treated as a required parameter", - ZSTR_VAL(func_name), ZSTR_VAL(name), ZSTR_VAL(zend_ast_get_str(required_param_ast->child[1]))); + func_name, name, zend_ast_get_str(required_param_ast->child[1])); zend_string_release(func_name); } @@ -8452,14 +8452,14 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32 "Cannot declare variadic promoted property"); } if (zend_hash_exists(&scope->properties_info, name)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", - ZSTR_VAL(scope->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %pS::$%pS", + scope->name, name); } if (ZEND_TYPE_FULL_MASK(arg_info->type) & MAY_BE_CALLABLE) { zend_string *str = zend_type_to_string(arg_info->type); zend_error_noreturn(E_COMPILE_ERROR, - "Property %s::$%s cannot have type %s", - ZSTR_VAL(scope->name), ZSTR_VAL(name), ZSTR_VAL(str)); + "Property %pS::$%pS cannot have type %pS", + scope->name, name, str); } if (!(property_flags & ZEND_ACC_READONLY) && (scope->ce_flags & ZEND_ACC_READONLY_CLASS)) { @@ -8483,8 +8483,8 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32 ZVAL_UNDEF(&default_value); } else { if (property_flags & ZEND_ACC_READONLY) { - zend_error_noreturn(E_COMPILE_ERROR, "Readonly property %s::$%s must have type", - ZSTR_VAL(scope->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Readonly property %pS::$%pS must have type", + scope->name, name); } ZVAL_NULL(&default_value); @@ -8790,44 +8790,44 @@ static zend_string *zend_begin_method_decl(zend_op_array *op_array, zend_string // Don't say that the class should be declared abstract if it is // anonymous or an enum and can't be abstract if (ce->ce_flags & ZEND_ACC_ANON_CLASS) { - zend_error_noreturn(E_COMPILE_ERROR, "Anonymous class method %s() must not be abstract", - ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Anonymous class method %pS() must not be abstract", + name); } else if (ce->ce_flags & (ZEND_ACC_ENUM|ZEND_ACC_INTERFACE)) { - zend_error_noreturn(E_COMPILE_ERROR, "%s method %s::%s() must not be abstract", - zend_get_object_type_case(ce, true), ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "%s method %pS::%pS() must not be abstract", + zend_get_object_type_case(ce, true), ce->name, name); } else { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s declares abstract method %s() and must therefore be declared abstract", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Class %pS declares abstract method %pS() and must therefore be declared abstract", + ce->name, name); } } if (in_interface) { if (!(fn_flags & ZEND_ACC_PUBLIC)) { zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface method " - "%s::%s() must be public", ZSTR_VAL(ce->name), ZSTR_VAL(name)); + "%pS::%pS() must be public", ce->name, name); } if (fn_flags & ZEND_ACC_FINAL) { zend_error_noreturn(E_COMPILE_ERROR, "Interface method " - "%s::%s() must not be final", ZSTR_VAL(ce->name), ZSTR_VAL(name)); + "%pS::%pS() must not be final", ce->name, name); } op_array->fn_flags |= ZEND_ACC_ABSTRACT; } if (op_array->fn_flags & ZEND_ACC_ABSTRACT) { if ((op_array->fn_flags & ZEND_ACC_PRIVATE) && !(ce->ce_flags & ZEND_ACC_TRAIT)) { - zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot be declared private", - in_interface ? "Interface" : "Abstract", ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "%s function %pS::%pS() cannot be declared private", + in_interface ? "Interface" : "Abstract", ce->name, name); } if (has_body) { - zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot contain body", - in_interface ? "Interface" : "Abstract", ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "%s function %pS::%pS() cannot contain body", + in_interface ? "Interface" : "Abstract", ce->name, name); } ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS; } else if (!has_body) { - zend_error_noreturn(E_COMPILE_ERROR, "Non-abstract method %s::%s() must contain body", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Non-abstract method %pS::%pS() must contain body", + ce->name, name); } op_array->scope = ce; @@ -8837,8 +8837,8 @@ static zend_string *zend_begin_method_decl(zend_op_array *op_array, zend_string lcname = zend_new_interned_string(lcname); if (zend_hash_add_ptr(&ce->function_table, lcname, op_array) == NULL) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %pS::%pS()", + ce->name, name); } zend_add_magic_method(ce, (zend_function *) op_array, lcname); @@ -8919,8 +8919,8 @@ static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array, const zend_string *import_name = zend_hash_find_ptr_lc(FC(imports_function), unqualified_name); if (import_name && !zend_string_equals_ci(lcname, import_name)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare function %s() (previously declared as local import)", - ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare function %pS() (previously declared as local import)", + name); } } @@ -9238,8 +9238,8 @@ static void zend_compile_property_hooks( zend_property_hook_kind hook_kind = zend_get_property_hook_kind_from_name(name); if (hook_kind == (zend_property_hook_kind)-1) { zend_error_noreturn(E_COMPILE_ERROR, - "Unknown hook \"%s\" for property %s::$%s, expected \"get\" or \"set\"", - ZSTR_VAL(name), ZSTR_VAL(ce->name), ZSTR_VAL(prop_name)); + "Unknown hook \"%pS\" for property %pS::$%pS, expected \"get\" or \"set\"", + name, ce->name, prop_name); } if (stmt_ast && stmt_ast->kind == ZEND_AST_PROPERTY_HOOK_SHORT_BODY) { @@ -9260,8 +9260,8 @@ static void zend_compile_property_hooks( if (hook_kind == ZEND_PROPERTY_HOOK_GET) { if (hook->child[0]) { - zend_error_noreturn(E_COMPILE_ERROR, "get hook of property %s::$%s must not have a parameter list", - ZSTR_VAL(ce->name), ZSTR_VAL(prop_name)); + zend_error_noreturn(E_COMPILE_ERROR, "get hook of property %pS::$%pS must not have a parameter list", + ce->name, prop_name); } hook->child[0] = zend_ast_create_list(0, ZEND_AST_PARAM_LIST); @@ -9272,21 +9272,21 @@ static void zend_compile_property_hooks( if (hook->child[0]) { const zend_ast_list *param_list = zend_ast_get_list(hook->child[0]); if (param_list->children != 1) { - zend_error_noreturn(E_COMPILE_ERROR, "%s hook of property %s::$%s must accept exactly one parameters", - ZSTR_VAL(name), ZSTR_VAL(ce->name), ZSTR_VAL(prop_name)); + zend_error_noreturn(E_COMPILE_ERROR, "%pS hook of property %pS::$%pS must accept exactly one parameters", + name, ce->name, prop_name); } const zend_ast *value_param_ast = param_list->child[0]; if (value_param_ast->attr & ZEND_PARAM_REF) { - zend_error_noreturn(E_COMPILE_ERROR, "Parameter $%s of %s hook %s::$%s must not be pass-by-reference", - ZSTR_VAL(zend_ast_get_str(value_param_ast->child[1])), ZSTR_VAL(name), ZSTR_VAL(ce->name), ZSTR_VAL(prop_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Parameter $%pS of %pS hook %pS::$%pS must not be pass-by-reference", + zend_ast_get_str(value_param_ast->child[1]), name, ce->name, prop_name); } if (value_param_ast->attr & ZEND_PARAM_VARIADIC) { - zend_error_noreturn(E_COMPILE_ERROR, "Parameter $%s of %s hook %s::$%s must not be variadic", - ZSTR_VAL(zend_ast_get_str(value_param_ast->child[1])), ZSTR_VAL(name), ZSTR_VAL(ce->name), ZSTR_VAL(prop_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Parameter $%pS of %pS hook %pS::$%pS must not be variadic", + zend_ast_get_str(value_param_ast->child[1]), name, ce->name, prop_name); } if (value_param_ast->child[2]) { - zend_error_noreturn(E_COMPILE_ERROR, "Parameter $%s of %s hook %s::$%s must not have a default value", - ZSTR_VAL(zend_ast_get_str(value_param_ast->child[1])), ZSTR_VAL(name), ZSTR_VAL(ce->name), ZSTR_VAL(prop_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Parameter $%pS of %pS hook %pS::$%pS must not have a default value", + zend_ast_get_str(value_param_ast->child[1]), name, ce->name, prop_name); } if ((prop_type_ast != NULL) != (value_param_ast->child[0] != NULL)) { zend_hooked_property_variance_error_ex(zend_ast_get_str(value_param_ast->child[1]), ce->name, prop_info->name); @@ -9307,7 +9307,7 @@ static void zend_compile_property_hooks( ZEND_UNREACHABLE(); } - hook->name = zend_strpprintf(0, "$%s::%s", ZSTR_VAL(prop_name), ZSTR_VAL(name)); + hook->name = zend_strpprintf(0, "$%pS::%pS", prop_name, name); zend_function *func = (zend_function *) zend_compile_func_decl_ex( NULL, (zend_ast *) hook, FUNC_DECL_LEVEL_NESTED, prop_info->name, hook_kind); @@ -9321,7 +9321,7 @@ static void zend_compile_property_hooks( if (prop_info->hooks[hook_kind]) { zend_error_noreturn(E_COMPILE_ERROR, - "Cannot redeclare property hook \"%s\"", ZSTR_VAL(name)); + "Cannot redeclare property hook \"%pS\"", name); } prop_info->hooks[hook_kind] = func; @@ -9371,7 +9371,7 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f uint32_t i, children = list->children; if (ce->ce_flags & ZEND_ACC_ENUM) { - zend_error_noreturn(E_COMPILE_ERROR, "Enum %s cannot include properties", ZSTR_VAL(ce->name)); + zend_error_noreturn(E_COMPILE_ERROR, "Enum %pS cannot include properties", ce->name); } if ((flags & ZEND_ACC_FINAL) && (flags & ZEND_ACC_PRIVATE)) { @@ -9429,8 +9429,8 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f if (ZEND_TYPE_FULL_MASK(type) & (MAY_BE_VOID|MAY_BE_NEVER|MAY_BE_CALLABLE)) { zend_string *str = zend_type_to_string(type); zend_error_noreturn(E_COMPILE_ERROR, - "Property %s::$%s cannot have type %s", - ZSTR_VAL(ce->name), ZSTR_VAL(name), ZSTR_VAL(str)); + "Property %pS::$%pS cannot have type %pS", + ce->name, name, str); } } @@ -9440,8 +9440,8 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f } if (zend_hash_exists(&ce->properties_info, name)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %pS::$%pS", + ce->name, name); } if (*value_ast_ptr) { @@ -9455,14 +9455,14 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f zend_string *nullable_str = zend_type_to_string(type); zend_error_noreturn(E_COMPILE_ERROR, - "Default value for property of type %s may not be null. " - "Use the nullable type %s to allow null default value", - ZSTR_VAL(str), ZSTR_VAL(nullable_str)); + "Default value for property of type %pS may not be null. " + "Use the nullable type %pS to allow null default value", + str, nullable_str); } else { zend_error_noreturn(E_COMPILE_ERROR, - "Cannot use %s as default value for property %s::$%s of type %s", + "Cannot use %s as default value for property %pS::$%pS of type %pS", zend_zval_value_name(&value_zv), - ZSTR_VAL(ce->name), ZSTR_VAL(name), ZSTR_VAL(str)); + ce->name, name, str); } } } else if (!ZEND_TYPE_IS_SET(type) && !hooks_ast) { @@ -9477,18 +9477,18 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f if (flags & ZEND_ACC_READONLY) { if (!ZEND_TYPE_IS_SET(type)) { - zend_error_noreturn(E_COMPILE_ERROR, "Readonly property %s::$%s must have type", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Readonly property %pS::$%pS must have type", + ce->name, name); } if (!Z_ISUNDEF(value_zv)) { zend_error_noreturn(E_COMPILE_ERROR, - "Readonly property %s::$%s cannot have default value", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + "Readonly property %pS::$%pS cannot have default value", + ce->name, name); } if (flags & ZEND_ACC_STATIC) { zend_error_noreturn(E_COMPILE_ERROR, - "Static property %s::$%s cannot be readonly", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + "Static property %pS::$%pS cannot be readonly", + ce->name, name); } } @@ -9557,15 +9557,15 @@ static void zend_compile_class_const_decl(zend_ast *ast, uint32_t flags, zend_as if (type_mask != MAY_BE_ANY && (type_mask & (MAY_BE_CALLABLE|MAY_BE_VOID|MAY_BE_NEVER))) { zend_string *type_str = zend_type_to_string(type); - zend_error_noreturn(E_COMPILE_ERROR, "Class constant %s::%s cannot have type %s", - ZSTR_VAL(ce->name), ZSTR_VAL(name), ZSTR_VAL(type_str)); + zend_error_noreturn(E_COMPILE_ERROR, "Class constant %pS::%pS cannot have type %pS", + ce->name, name, type_str); } } if (UNEXPECTED((flags & ZEND_ACC_PRIVATE) && (flags & ZEND_ACC_FINAL))) { zend_error_noreturn( - E_COMPILE_ERROR, "Private constant %s::%s cannot be final as it is not visible to other classes", - ZSTR_VAL(ce->name), ZSTR_VAL(name) + E_COMPILE_ERROR, "Private constant %pS::%pS cannot be final as it is not visible to other classes", + ce->name, name ); } @@ -9574,8 +9574,8 @@ static void zend_compile_class_const_decl(zend_ast *ast, uint32_t flags, zend_as if (Z_TYPE(value_zv) != IS_CONSTANT_AST && ZEND_TYPE_IS_SET(type) && !zend_is_valid_default_value(type, &value_zv)) { zend_string *type_str = zend_type_to_string(type); - zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as value for class constant %s::%s of type %s", - zend_zval_type_name(&value_zv), ZSTR_VAL(ce->name), ZSTR_VAL(name), ZSTR_VAL(type_str)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as value for class constant %pS::%pS of type %pS", + zend_zval_type_name(&value_zv), ce->name, name, type_str); } c = zend_declare_typed_class_constant(ce, name, &value_zv, flags, doc_comment, type); @@ -9690,7 +9690,7 @@ static void zend_compile_use_trait(const zend_ast *ast) /* {{{ */ if (ce->ce_flags & ZEND_ACC_INTERFACE) { zend_string *name = zend_ast_get_str(trait_ast); zend_error_noreturn(E_COMPILE_ERROR, "Cannot use traits inside of interfaces. " - "%s is used in %s", ZSTR_VAL(name), ZSTR_VAL(ce->name)); + "%pS is used in %pS", name, ce->name); } ce->trait_names[ce->num_traits].name = @@ -9753,8 +9753,8 @@ static zend_string *zend_generate_anon_class_name(const zend_ast_decl *decl) prefix = zend_resolve_const_class_name_reference(list->child[0], "interface name"); } - zend_string *result = zend_strpprintf(0, "%s@anonymous%c%s:%" PRIu32 "$%" PRIx32, - ZSTR_VAL(prefix), '\0', ZSTR_VAL(filename), start_lineno, CG(rtd_key_counter)++); + zend_string *result = zend_strpprintf(0, "%pS@anonymous%c%pS:%" PRIu32 "$%" PRIx32, + prefix, '\0', filename, start_lineno, CG(rtd_key_counter)++); zend_string_release(prefix); return zend_new_interned_string(result); } @@ -9767,8 +9767,8 @@ static void zend_compile_enum_backing_type(zend_class_entry *ce, zend_ast *enum_ if (ZEND_TYPE_IS_COMPLEX(type) || (type_mask != MAY_BE_LONG && type_mask != MAY_BE_STRING)) { zend_string *type_string = zend_type_to_string(type); zend_error_noreturn(E_COMPILE_ERROR, - "Enum backing type must be int or string, %s given", - ZSTR_VAL(type_string)); + "Enum backing type must be int or string, %pS given", + type_string); } if (type_mask == MAY_BE_LONG) { ce->enum_backing_type = IS_LONG; @@ -9816,8 +9816,8 @@ static void zend_compile_class_decl(znode *result, const zend_ast *ast, bool top zend_string *import_name = zend_hash_find_ptr_lc(FC(imports), unqualified_name); if (import_name && !zend_string_equals_ci(lcname, import_name)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s " - "(previously declared as local import)", ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %pS " + "(previously declared as local import)", name); } } @@ -9963,7 +9963,7 @@ static void zend_compile_class_decl(znode *result, const zend_ast *ast, bool top if (!zend_hash_add_ptr(CG(class_table), lcname, ce)) { /* We checked above that the class name is not used. This really shouldn't happen. */ zend_error_noreturn(E_ERROR, - "Runtime definition key collision for %s. This is a bug", ZSTR_VAL(name)); + "Runtime definition key collision for %pS. This is a bug", name); } } else { /* Generate RTD keys until we find one that isn't in use yet. */ @@ -10025,13 +10025,13 @@ static void zend_compile_enum_case(zend_ast *ast) // Remove case_value_ast from the original AST to avoid freeing it, as it will be freed by zend_const_expr_to_zval ast->child[1] = NULL; if (enum_class->enum_backing_type != IS_UNDEF && case_value_ast == NULL) { - zend_error_noreturn(E_COMPILE_ERROR, "Case %s of backed enum %s must have a value", - ZSTR_VAL(enum_case_name), - ZSTR_VAL(enum_class_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Case %pS of backed enum %pS must have a value", + enum_case_name, + enum_class_name); } else if (enum_class->enum_backing_type == IS_UNDEF && case_value_ast != NULL) { - zend_error_noreturn(E_COMPILE_ERROR, "Case %s of non-backed enum %s must not have a value", - ZSTR_VAL(enum_case_name), - ZSTR_VAL(enum_class_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Case %pS of non-backed enum %pS must not have a value", + enum_case_name, + enum_class_name); } zend_ast *const_enum_init_ast = zend_ast_create(ZEND_AST_CONST_ENUM_INIT, @@ -10123,8 +10123,8 @@ static void zend_check_already_in_use(uint32_t type, const zend_string *old_name return; } - zend_error_noreturn(E_COMPILE_ERROR, "Cannot use%s %s as %s because the name " - "is already in use", zend_get_use_type_str(type), ZSTR_VAL(old_name), ZSTR_VAL(new_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use%s %pS as %pS because the name " + "is already in use", zend_get_use_type_str(type), old_name, new_name); } /* }}} */ @@ -10156,8 +10156,8 @@ static void zend_compile_use(zend_ast *ast) /* {{{ */ new_name = zend_string_copy(old_name); if (!current_ns) { - zend_error(E_WARNING, "The use statement with non-compound name '%s' " - "has no effect", ZSTR_VAL(new_name)); + zend_error(E_WARNING, "The use statement with non-compound name '%pS' " + "has no effect", new_name); } } } @@ -10169,8 +10169,8 @@ static void zend_compile_use(zend_ast *ast) /* {{{ */ } if (type == ZEND_SYMBOL_CLASS && zend_is_reserved_class_name(new_name)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' " - "is a special class name", ZSTR_VAL(old_name), ZSTR_VAL(new_name), ZSTR_VAL(new_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %pS as %pS because '%pS' " + "is a special class name", old_name, new_name, new_name); } if (current_ns) { @@ -10191,8 +10191,8 @@ static void zend_compile_use(zend_ast *ast) /* {{{ */ zend_string_addref(old_name); old_name = zend_new_interned_string(old_name); if (!zend_hash_add_ptr(current_import, lookup_name, old_name)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot use%s %s as %s because the name " - "is already in use", zend_get_use_type_str(type), ZSTR_VAL(old_name), ZSTR_VAL(new_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use%s %pS as %pS because the name " + "is already in use", zend_get_use_type_str(type), old_name, new_name); } zend_string_release_ex(lookup_name, 0); @@ -10248,7 +10248,7 @@ static void zend_compile_const_decl(zend_ast *ast) /* {{{ */ if (zend_get_special_const(ZSTR_VAL(unqualified_name), ZSTR_LEN(unqualified_name))) { zend_error_noreturn(E_COMPILE_ERROR, - "Cannot redeclare constant '%s'", ZSTR_VAL(unqualified_name)); + "Cannot redeclare constant '%pS'", unqualified_name); } name = zend_prefix_with_ns(unqualified_name); @@ -10257,8 +10257,8 @@ static void zend_compile_const_decl(zend_ast *ast) /* {{{ */ if (FC(imports_const)) { zend_string *import_name = zend_hash_find_ptr(FC(imports_const), unqualified_name); if (import_name && !zend_string_equals(import_name, name)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare const %s because " - "the name is already in use", ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare const %pS because " + "the name is already in use", name); } } @@ -10336,7 +10336,7 @@ static void zend_compile_namespace(const zend_ast *ast) /* {{{ */ name = zend_ast_get_str(name_ast); if (zend_string_equals_literal_ci(name, "namespace")) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%pS' as namespace name", name); } FC(current_namespace) = zend_string_copy(name); diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 18292203bee9..a570e2510853 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -351,14 +351,14 @@ ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string * c = zend_hash_find_ptr(CE_CONSTANTS_TABLE(ce), constant_name); if (c == NULL) { if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) { - zend_throw_error(NULL, "Undefined constant %s::%s", ZSTR_VAL(class_name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", class_name, constant_name); goto failure; } ret_constant = NULL; } else { if (!zend_verify_const_access(c, scope)) { if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), class_name, constant_name); } goto failure; } @@ -366,7 +366,7 @@ ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string * if (UNEXPECTED(ce->ce_flags & ZEND_ACC_TRAIT)) { /** Prevent accessing trait constants directly on cases like \defined() or \constant(), etc. */ if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(class_name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", class_name, constant_name); } goto failure; } @@ -394,7 +394,7 @@ ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string * zend_result ret; if (IS_CONSTANT_VISITED(ret_constant)) { - zend_throw_error(NULL, "Cannot declare self-referencing constant %s::%s", ZSTR_VAL(class_name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot declare self-referencing constant %pS::%pS", class_name, constant_name); ret_constant = NULL; goto failure; } @@ -543,7 +543,7 @@ ZEND_API zend_constant *zend_register_constant(zend_constant *c) || (!persistent && zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name))) || (ret = zend_hash_add_constant(EG(zend_constants), name, c)) == NULL ) { - zend_error(E_WARNING, "Constant %s already defined, this will be an error in PHP 9", ZSTR_VAL(name)); + zend_error(E_WARNING, "Constant %pS already defined, this will be an error in PHP 9", name); zend_string_release(c->name); if (c->filename) { zend_string_release(c->filename); diff --git a/Zend/zend_enum.c b/Zend/zend_enum.c index ecebe7a5d51b..a9b922a8f317 100644 --- a/Zend/zend_enum.c +++ b/Zend/zend_enum.c @@ -27,7 +27,7 @@ #define ZEND_ENUM_DISALLOW_MAGIC_METHOD(propertyName, methodName) \ do { \ if (ce->propertyName) { \ - zend_error_noreturn(E_COMPILE_ERROR, "Enum %s cannot include magic method %s", ZSTR_VAL(ce->name), methodName); \ + zend_error_noreturn(E_COMPILE_ERROR, "Enum %pS cannot include magic method %s", ce->name, methodName); \ } \ } while (0); @@ -83,8 +83,8 @@ static void zend_verify_enum_properties(const zend_class_entry *ce) continue; } // FIXME: File/line number for traits? - zend_error_noreturn(E_COMPILE_ERROR, "Enum %s cannot include properties", - ZSTR_VAL(ce->name)); + zend_error_noreturn(E_COMPILE_ERROR, "Enum %pS cannot include properties", + ce->name); } ZEND_HASH_FOREACH_END(); } @@ -114,7 +114,7 @@ static void zend_verify_enum_magic_methods(const zend_class_entry *ce) const char *forbidden_method = forbidden_methods[i]; if (zend_hash_str_exists(&ce->function_table, forbidden_method, strlen(forbidden_method))) { - zend_error_noreturn(E_COMPILE_ERROR, "Enum %s cannot include magic method %s", ZSTR_VAL(ce->name), forbidden_method); + zend_error_noreturn(E_COMPILE_ERROR, "Enum %pS cannot include magic method %s", ce->name, forbidden_method); } } } @@ -123,7 +123,7 @@ static void zend_verify_enum_interfaces(const zend_class_entry *ce) { if (zend_class_implements_interface(ce, zend_ce_serializable)) { zend_error_noreturn(E_COMPILE_ERROR, - "Enum %s cannot implement the Serializable interface", ZSTR_VAL(ce->name)); + "Enum %pS cannot implement the Serializable interface", ce->name); } } @@ -140,9 +140,9 @@ static int zend_implement_unit_enum(zend_class_entry *interface, zend_class_entr return SUCCESS; } - zend_error_noreturn(E_ERROR, "Non-enum class %s cannot implement interface %s", - ZSTR_VAL(class_type->name), - ZSTR_VAL(interface->name)); + zend_error_noreturn(E_ERROR, "Non-enum class %pS cannot implement interface %pS", + class_type->name, + interface->name); return FAILURE; } @@ -150,16 +150,16 @@ static int zend_implement_unit_enum(zend_class_entry *interface, zend_class_entr static int zend_implement_backed_enum(zend_class_entry *interface, zend_class_entry *class_type) { if (!(class_type->ce_flags & ZEND_ACC_ENUM)) { - zend_error_noreturn(E_ERROR, "Non-enum class %s cannot implement interface %s", - ZSTR_VAL(class_type->name), - ZSTR_VAL(interface->name)); + zend_error_noreturn(E_ERROR, "Non-enum class %pS cannot implement interface %pS", + class_type->name, + interface->name); return FAILURE; } if (class_type->enum_backing_type == IS_UNDEF) { - zend_error_noreturn(E_ERROR, "Non-backed enum %s cannot implement interface %s", - ZSTR_VAL(class_type->name), - ZSTR_VAL(interface->name)); + zend_error_noreturn(E_ERROR, "Non-backed enum %pS cannot implement interface %pS", + class_type->name, + interface->name); return FAILURE; } @@ -241,10 +241,10 @@ zend_result zend_enum_build_backed_enum_table(zend_class_entry *ce) zend_long long_key = Z_LVAL_P(case_value); const zval *existing_case_name = zend_hash_index_find(backed_enum_table, long_key); if (existing_case_name) { - zend_throw_error(NULL, "Duplicate value in enum %s for cases %s and %s", - ZSTR_VAL(enum_class_name), - Z_STRVAL_P(existing_case_name), - ZSTR_VAL(name)); + zend_throw_error(NULL, "Duplicate value in enum %pS for cases %pS and %pS", + enum_class_name, + Z_STR_P(existing_case_name), + name); goto failure; } Z_TRY_ADDREF_P(case_name); @@ -254,10 +254,10 @@ zend_result zend_enum_build_backed_enum_table(zend_class_entry *ce) zend_string *string_key = Z_STR_P(case_value); const zval *existing_case_name = zend_hash_find(backed_enum_table, string_key); if (existing_case_name != NULL) { - zend_throw_error(NULL, "Duplicate value in enum %s for cases %s and %s", - ZSTR_VAL(enum_class_name), - Z_STRVAL_P(existing_case_name), - ZSTR_VAL(name)); + zend_throw_error(NULL, "Duplicate value in enum %pS for cases %pS and %pS", + enum_class_name, + Z_STR_P(existing_case_name), + name); goto failure; } Z_TRY_ADDREF_P(case_name); @@ -327,10 +327,10 @@ ZEND_API zend_result zend_enum_get_case_by_value(zend_object **result, zend_clas } if (ce->enum_backing_type == IS_LONG) { - zend_value_error(ZEND_LONG_FMT " is not a valid backing value for enum %s", long_key, ZSTR_VAL(ce->name)); + zend_value_error(ZEND_LONG_FMT " is not a valid backing value for enum %pS", long_key, ce->name); } else { ZEND_ASSERT(ce->enum_backing_type == IS_STRING); - zend_value_error("\"%s\" is not a valid backing value for enum %s", ZSTR_VAL(string_key), ZSTR_VAL(ce->name)); + zend_value_error("\"%pS\" is not a valid backing value for enum %pS", string_key, ce->name); } return FAILURE; } @@ -443,7 +443,7 @@ static void zend_enum_register_func(zend_class_entry *ce, zend_known_string_id n } if (!zend_hash_add_ptr(&ce->function_table, name, zif)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %pS::%pS()", ce->name, name); } } diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 1b8297881d60..3ecaa30bc7ea 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -78,11 +78,11 @@ static int zend_implement_throwable(zend_class_entry *interface, zend_class_entr zend_error_noreturn(E_ERROR, can_extend - ? "%s %s cannot implement interface %s, extend Exception or Error instead" - : "%s %s cannot implement interface %s", + ? "%s %pS cannot implement interface %pS, extend Exception or Error instead" + : "%s %pS cannot implement interface %pS", zend_get_object_type_uc(class_type), - ZSTR_VAL(class_type->name), - ZSTR_VAL(interface->name)); + class_type->name, + interface->name); return FAILURE; } /* }}} */ @@ -497,8 +497,8 @@ ZEND_METHOD(ErrorException, getSeverity) tmp = zend_hash_find(ht, key); \ if (tmp) { \ if (UNEXPECTED(Z_TYPE_P(tmp) != IS_STRING)) { \ - zend_error(E_WARNING, "Value for %s is not a string", \ - ZSTR_VAL(key)); \ + zend_error(E_WARNING, "Value for %pS is not a string", \ + key); \ smart_str_appends(str, "[unknown]"); \ } else { \ smart_str_append(str, Z_STR_P(tmp)); \ @@ -774,7 +774,7 @@ ZEND_METHOD(Exception, __toString) } if ((Z_OBJCE_P(exception) == zend_ce_type_error || Z_OBJCE_P(exception) == zend_ce_argument_count_error) && strstr(ZSTR_VAL(message), ", called in ")) { - zend_string *real_message = zend_strpprintf_unchecked(0, "%S and defined", message); + zend_string *real_message = zend_strpprintf(0, "%pS and defined", message); zend_string_release_ex(message, 0); message = real_message; } @@ -789,11 +789,11 @@ ZEND_METHOD(Exception, __toString) zval message_zv; ZVAL_STR(&message_zv, message); - str = zend_strpprintf_unchecked(0, "%S: %S in %S:" ZEND_LONG_FMT "\nStack trace:\n%S%s%S", + str = zend_strpprintf(0, "%pS: %pS in %pS:" ZEND_LONG_FMT "\nStack trace:\n%pS%s%pS", name, message, file, line, tmp_trace, ZSTR_LEN(prev_str) ? "\n\nNext " : "", prev_str); } else { - str = zend_strpprintf_unchecked(0, "%S in %S:" ZEND_LONG_FMT "\nStack trace:\n%S%s%S", + str = zend_strpprintf(0, "%pS in %pS:" ZEND_LONG_FMT "\nStack trace:\n%pS%s%pS", name, file, line, tmp_trace, ZSTR_LEN(prev_str) ? "\n\nNext " : "", prev_str); } @@ -1002,7 +1002,7 @@ ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severit zend_unwrap_reference(&tmp); } if (Z_TYPE(tmp) != IS_STRING) { - zend_error(E_WARNING, "%s::__toString() must return a string", ZSTR_VAL(ce_exception->name)); + zend_error(E_WARNING, "%pS::__toString() must return a string", ce_exception->name); } else { zend_update_property_ex(i_get_exception_base(ex), ex, ZSTR_KNOWN(ZEND_STR_STRING), &tmp); } @@ -1020,8 +1020,8 @@ ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severit } zend_error_va(E_WARNING, (file && ZSTR_LEN(file) > 0) ? file : NULL, line, - "Uncaught %s in exception handling during call to %s::__toString()", - ZSTR_VAL(Z_OBJCE(zv)->name), ZSTR_VAL(ce_exception->name)); + "Uncaught %pS in exception handling during call to %pS::__toString()", + Z_OBJCE(zv)->name, ce_exception->name); if (file) { zend_string_release_ex(file, 0); @@ -1034,7 +1034,7 @@ ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severit zend_error_va(severity | E_DONT_BAIL, (file && ZSTR_LEN(file) > 0) ? file : NULL, line, - "Uncaught %S\n thrown", str); + "Uncaught %pS\n thrown", str); zend_string_release_ex(str, 0); zend_string_release_ex(file, 0); @@ -1042,7 +1042,7 @@ ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severit /* We successfully unwound, nothing more to do. * We still return FAILURE in this case, as further execution should still be aborted. */ } else { - zend_error(severity, "Uncaught exception %s", ZSTR_VAL(ce_exception->name)); + zend_error(severity, "Uncaught exception %pS", ce_exception->name); } OBJ_RELEASE(ex); @@ -1063,7 +1063,7 @@ ZEND_NORETURN void zend_exception_uncaught_error(const char *format, ...) { zend_string *exception_str = zval_get_string(&exception_zv); zend_error_noreturn(E_ERROR, - "%s: Uncaught %s", ZSTR_VAL(prefix), ZSTR_VAL(exception_str)); + "%pS: Uncaught %pS", prefix, exception_str); } ZEND_API ZEND_COLD void zend_throw_exception_object(zval *exception) /* {{{ */ diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index ab371cbc4e22..8b22a083450b 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -271,7 +271,7 @@ static zend_never_inline ZEND_COLD zval* zval_undefined_cv(uint32_t var EXECUTE_ { if (EXPECTED(EG(exception) == NULL)) { zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var)); - zend_error_unchecked(E_WARNING, "Undefined variable $%S", cv); + zend_error(E_WARNING, "Undefined variable $%pS", cv); } return &EG(uninitialized_zval); } @@ -605,8 +605,8 @@ ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_cannot_pass_by_refe zend_string *func_name = get_function_or_method_name(EX(call)->func); const char *param_name = get_function_arg_name(EX(call)->func, arg_num); - zend_throw_error(NULL, "%s(): Argument #%d%s%s%s could not be passed by reference", - ZSTR_VAL(func_name), arg_num, param_name ? " ($" : "", param_name ? param_name : "", param_name ? ")" : "" + zend_throw_error(NULL, "%pS(): Argument #%d%s%s%s could not be passed by reference", + func_name, arg_num, param_name ? " ($" : "", param_name ? param_name : "", param_name ? ")" : "" ); zend_string_release(func_name); @@ -615,9 +615,9 @@ ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_cannot_pass_by_refe static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_prop_error(const zend_property_info *prop) { zend_string *type_str = zend_type_to_string(prop->type); zend_type_error( - "Cannot auto-initialize an array inside property %s::$%s of type %s", - ZSTR_VAL(prop->ce->name), zend_get_unmangled_property_name(prop->name), - ZSTR_VAL(type_str) + "Cannot auto-initialize an array inside property %pS::$%s of type %pS", + prop->ce->name, zend_get_unmangled_property_name(prop->name), + type_str ); zend_string_release(type_str); } @@ -625,9 +625,9 @@ static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_prop_error(const static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_ref_error(const zend_property_info *prop) { zend_string *type_str = zend_type_to_string(prop->type); zend_type_error( - "Cannot auto-initialize an array inside a reference held by property %s::$%s of type %s", - ZSTR_VAL(prop->ce->name), zend_get_unmangled_property_name(prop->name), - ZSTR_VAL(type_str) + "Cannot auto-initialize an array inside a reference held by property %pS::$%s of type %pS", + prop->ce->name, zend_get_unmangled_property_name(prop->name), + type_str ); zend_string_release(type_str); } @@ -635,8 +635,8 @@ static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_ref_error(const static zend_never_inline ZEND_COLD void zend_throw_access_uninit_prop_by_ref_error( const zend_property_info *prop) { zend_throw_error(NULL, - "Cannot access uninitialized non-nullable property %s::$%s by reference", - ZSTR_VAL(prop->ce->name), + "Cannot access uninitialized non-nullable property %pS::$%s by reference", + prop->ce->name, zend_get_unmangled_property_name(prop->name)); } @@ -651,21 +651,21 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_throw_non_object_erro || opline->opcode == ZEND_POST_INC_OBJ || opline->opcode == ZEND_POST_DEC_OBJ) { zend_throw_error(NULL, - "Attempt to increment/decrement property \"%s\" on %s", - ZSTR_VAL(property_name), zend_zval_value_name(object) + "Attempt to increment/decrement property \"%pS\" on %s", + property_name, zend_zval_value_name(object) ); } else if (opline->opcode == ZEND_FETCH_OBJ_W || opline->opcode == ZEND_FETCH_OBJ_RW || opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG || opline->opcode == ZEND_ASSIGN_OBJ_REF) { zend_throw_error(NULL, - "Attempt to modify property \"%s\" on %s", - ZSTR_VAL(property_name), zend_zval_value_name(object) + "Attempt to modify property \"%pS\" on %s", + property_name, zend_zval_value_name(object) ); } else { zend_throw_error(NULL, - "Attempt to assign property \"%s\" on %s", - ZSTR_VAL(property_name), zend_zval_value_name(object) + "Attempt to assign property \"%pS\" on %s", + property_name, zend_zval_value_name(object) ); } zend_tmp_string_release(tmp_property_name); @@ -712,13 +712,13 @@ ZEND_API zend_never_inline ZEND_COLD void zend_verify_arg_error( ZEND_ASSERT(zf->common.type == ZEND_USER_FUNCTION && "Arginfo verification is not performed for internal functions"); if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) { - zend_argument_type_error(arg_num, "must be of type %s, %s given, called in %s on line %d", - ZSTR_VAL(need_msg), given_msg, - ZSTR_VAL(ptr->func->op_array.filename), ptr->opline->lineno + zend_argument_type_error(arg_num, "must be of type %pS, %s given, called in %pS on line %d", + need_msg, given_msg, + ptr->func->op_array.filename, ptr->opline->lineno ); } else { zend_argument_type_error(arg_num, - "must be of type %s, %s given", ZSTR_VAL(need_msg), given_msg); + "must be of type %pS, %s given", need_msg, given_msg); } zend_string_release(need_msg); @@ -837,8 +837,8 @@ static zend_never_inline ZEND_COLD void zend_verify_class_constant_type_error(co { zend_string *type_str = zend_type_to_string(c->type); - zend_type_error("Cannot assign %s to class constant %s::%s of type %s", - zend_zval_type_name(constant), ZSTR_VAL(c->ce->name), ZSTR_VAL(name), ZSTR_VAL(type_str)); + zend_type_error("Cannot assign %s to class constant %pS::%pS of type %pS", + zend_zval_type_name(constant), c->ce->name, name, type_str); zend_string_release(type_str); } @@ -853,11 +853,11 @@ static zend_never_inline ZEND_COLD void zend_verify_property_type_error(const ze } type_str = zend_type_to_string(info->type); - zend_type_error("Cannot assign %s to property %s::$%s of type %s", + zend_type_error("Cannot assign %s to property %pS::$%s of type %pS", zend_zval_value_name(property), - ZSTR_VAL(info->ce->name), + info->ce->name, zend_get_unmangled_property_name(info->name), - ZSTR_VAL(type_str)); + type_str); zend_string_release(type_str); } @@ -869,12 +869,12 @@ static zend_never_inline ZEND_COLD void zend_magic_get_property_type_inconsisten } zend_string *type_str = zend_type_to_string(info->type); - zend_type_error("Value of type %s returned from %s::__get() must be compatible with unset property %s::$%s of type %s", + zend_type_error("Value of type %s returned from %pS::__get() must be compatible with unset property %pS::$%s of type %pS", zend_zval_type_name(property), - ZSTR_VAL(info->ce->name), - ZSTR_VAL(info->ce->name), + info->ce->name, + info->ce->name, zend_get_unmangled_property_name(info->name), - ZSTR_VAL(type_str)); + type_str); zend_string_release(type_str); } @@ -893,7 +893,7 @@ zend_never_inline ZEND_COLD void zend_match_unhandled_error(const zval *value) smart_str_0(&msg); zend_throw_exception_ex( - zend_ce_unhandled_match_error, 0, "Unhandled match case %s", ZSTR_VAL(msg.s)); + zend_ce_unhandled_match_error, 0, "Unhandled match case %pS", msg.s); smart_str_free(&msg); } @@ -911,8 +911,8 @@ ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_readonly_property_m ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_readonly_property_indirect_modification_error(const zend_property_info *info) { - zend_throw_error(NULL, "Cannot indirectly modify readonly property %s::$%s", - ZSTR_VAL(info->ce->name), zend_get_unmangled_property_name(info->name)); + zend_throw_error(NULL, "Cannot indirectly modify readonly property %pS::$%s", + info->ce->name, zend_get_unmangled_property_name(info->name)); } ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_invalid_class_constant_type_error(const uint8_t type) @@ -922,8 +922,8 @@ ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_invalid_class_const ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_object_released_while_assigning_to_property_error(const zend_property_info *info) { - zend_throw_error(NULL, "Object was released while assigning to property %s::$%s", - ZSTR_VAL(info->ce->name), zend_get_unmangled_property_name(info->name)); + zend_throw_error(NULL, "Object was released while assigning to property %pS::$%s", + info->ce->name, zend_get_unmangled_property_name(info->name)); } ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_asymmetric_visibility_property_modification_error( @@ -948,11 +948,11 @@ ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_asymmetric_visibili } } - zend_throw_error(NULL, "Cannot %s %s property %s::$%s from %s%s", + zend_throw_error(NULL, "Cannot %s %s property %pS::$%pS from %s%s", operation, visibility, - ZSTR_VAL(prop_info->ce->name), - ZSTR_VAL(prop_info->name), + prop_info->ce->name, + prop_info->name, scope ? "scope " : "global scope", scope ? ZSTR_VAL(scope->name) : ""); } @@ -1349,17 +1349,17 @@ static void zend_verify_internal_func_info(const zend_function *fn, const zval * /* Always check refcount of arrays, as immutable arrays are RCN. */ if (Z_REFCOUNTED_P(retval) || Z_TYPE_P(retval) == IS_ARRAY) { if (!(type_mask & MAY_BE_RC1)) { - zend_error_noreturn(E_CORE_ERROR, "%s() missing rc1", ZSTR_VAL(name)); + zend_error_noreturn(E_CORE_ERROR, "%pS() missing rc1", name); } if (Z_REFCOUNT_P(retval) > 1 && !(type_mask & MAY_BE_RCN)) { - zend_error_noreturn(E_CORE_ERROR, "%s() missing rcn", ZSTR_VAL(name)); + zend_error_noreturn(E_CORE_ERROR, "%pS() missing rcn", name); } } const uint32_t type = 1u << Z_TYPE_P(retval); if (!(type_mask & type)) { - zend_error_noreturn(E_CORE_ERROR, "%s() missing type %s", - ZSTR_VAL(name), zend_get_type_by_const(Z_TYPE_P(retval))); + zend_error_noreturn(E_CORE_ERROR, "%pS() missing type %s", + name, zend_get_type_by_const(Z_TYPE_P(retval))); } if (Z_TYPE_P(retval) == IS_ARRAY) { @@ -1371,20 +1371,20 @@ static void zend_verify_internal_func_info(const zend_function *fn, const zval * if (str) { if (!(type_mask & MAY_BE_ARRAY_KEY_STRING)) { zend_error_noreturn(E_CORE_ERROR, - "%s() missing array_key_string", ZSTR_VAL(name)); + "%pS() missing array_key_string", name); } } else { if (!(type_mask & MAY_BE_ARRAY_KEY_LONG)) { zend_error_noreturn(E_CORE_ERROR, - "%s() missing array_key_long", ZSTR_VAL(name)); + "%pS() missing array_key_long", name); } } const uint32_t array_type = 1u << (Z_TYPE_P(val) + MAY_BE_ARRAY_SHIFT); if (!(type_mask & array_type)) { zend_error_noreturn(E_CORE_ERROR, - "%s() missing array element type %s", - ZSTR_VAL(name), zend_get_type_by_const(Z_TYPE_P(retval))); + "%pS() missing array element type %s", + name, zend_get_type_by_const(Z_TYPE_P(retval))); } /* Don't check all elements of large arrays. */ @@ -1402,20 +1402,20 @@ ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(c const zend_execute_data *ptr = EX(prev_execute_data); if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) { - zend_throw_error(zend_ce_argument_count_error, "Too few arguments to function %s%s%s(), %d passed in %s on line %d and %s %d expected", + zend_throw_error(zend_ce_argument_count_error, "Too few arguments to function %s%s%pS(), %d passed in %pS on line %d and %s %d expected", EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : "", EX(func)->common.scope ? "::" : "", - ZSTR_VAL(EX(func)->common.function_name), + EX(func)->common.function_name, EX_NUM_ARGS(), - ZSTR_VAL(ptr->func->op_array.filename), + ptr->func->op_array.filename, ptr->opline->lineno, EX(func)->common.required_num_args == EX(func)->common.num_args ? "exactly" : "at least", EX(func)->common.required_num_args); } else { - zend_throw_error(zend_ce_argument_count_error, "Too few arguments to function %s%s%s(), %d passed and %s %d expected", + zend_throw_error(zend_ce_argument_count_error, "Too few arguments to function %s%s%pS(), %d passed and %s %d expected", EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : "", EX(func)->common.scope ? "::" : "", - ZSTR_VAL(EX(func)->common.function_name), + EX(func)->common.function_name, EX_NUM_ARGS(), EX(func)->common.required_num_args == EX(func)->common.num_args ? "exactly" : "at least", EX(func)->common.required_num_args); @@ -1432,8 +1432,8 @@ ZEND_API zend_never_inline ZEND_COLD void zend_verify_return_error(const zend_fu zend_verify_type_error_common( zf, arg_info, value, &fname, &fsep, &fclass, &need_msg, &given_msg); - zend_type_error("%s%s%s(): Return value must be of type %s, %s returned", - fclass, fsep, fname, ZSTR_VAL(need_msg), given_msg); + zend_type_error("%s%s%s(): Return value must be of type %pS, %s returned", + fclass, fsep, fname, need_msg, given_msg); zend_string_release(need_msg); } @@ -1442,8 +1442,8 @@ ZEND_API zend_never_inline ZEND_COLD void zend_verify_never_error(const zend_fun { zend_string *func_name = get_function_or_method_name(zf); - zend_type_error("%s(): never-returning %s must not implicitly return", - ZSTR_VAL(func_name), zf->common.scope ? "method" : "function"); + zend_type_error("%pS(): never-returning %s must not implicitly return", + func_name, zf->common.scope ? "method" : "function"); zend_string_release(func_name); } @@ -1459,8 +1459,8 @@ static zend_never_inline ZEND_COLD void zend_verify_internal_return_error(const zend_verify_type_error_common( zf, arg_info, value, &fname, &fsep, &fclass, &need_msg, &given_msg); - zend_error_noreturn(E_CORE_ERROR, "%s%s%s(): Return value must be of type %s, %s returned", - fclass, fsep, fname, ZSTR_VAL(need_msg), given_msg); + zend_error_noreturn(E_CORE_ERROR, "%s%s%s(): Return value must be of type %pS, %s returned", + fclass, fsep, fname, need_msg, given_msg); } static zend_never_inline ZEND_COLD void zend_verify_void_return_error(const zend_function *zf, const char *returned_msg, const char *returned_kind) @@ -1537,7 +1537,7 @@ ZEND_API bool zend_never_inline zend_verify_class_constant_type(const zend_class static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array(const zend_object *object) { - zend_throw_error(NULL, "Cannot use object of type %s as array", ZSTR_VAL(object->ce->name)); + zend_throw_error(NULL, "Cannot use object of type %pS as array", object->ce->name); } static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_array_offset_access(const zval *offset) @@ -1729,7 +1729,7 @@ static zend_never_inline zend_long zend_check_string_offset(const zval *dim, int if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL, /* allow errors */ true, NULL, &trailing_data)) { if (UNEXPECTED(trailing_data) && type != BP_VAR_UNSET) { - zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim)); + zend_error(E_WARNING, "Illegal string offset \"%pS\"", Z_STR_P(dim)); } return offset; } @@ -1849,9 +1849,9 @@ ZEND_COLD static zend_result ZEND_FASTCALL get_deprecation_suffix_from_attribute } /* Construct the suffix. */ - *message_suffix = zend_strpprintf_unchecked( + *message_suffix = zend_strpprintf( 0, - "%s%S%s%S", + "%s%pS%s%pS", ZSTR_LEN(since) > 0 ? " since " : "", since, ZSTR_LEN(message) > 0 ? ", " : "", @@ -1878,14 +1878,14 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(const zend_functi int code = fbc->type == ZEND_INTERNAL_FUNCTION ? E_DEPRECATED : E_USER_DEPRECATED; if (fbc->common.scope) { - zend_error_unchecked(code, "Method %s::%s() is deprecated%S", - ZSTR_VAL(fbc->common.scope->name), - ZSTR_VAL(fbc->common.function_name), + zend_error(code, "Method %pS::%pS() is deprecated%pS", + fbc->common.scope->name, + fbc->common.function_name, message_suffix ); } else { - zend_error_unchecked(code, "Function %s() is deprecated%S", - ZSTR_VAL(fbc->common.function_name), + zend_error(code, "Function %pS() is deprecated%pS", + fbc->common.function_name, message_suffix ); } @@ -1932,9 +1932,9 @@ ZEND_COLD static zend_result ZEND_FASTCALL get_nodiscard_suffix_from_attribute(H } /* Construct the suffix. */ - *message_suffix = zend_strpprintf_unchecked( + *message_suffix = zend_strpprintf( 0, - "%s%S", + "%s%pS", ZSTR_LEN(message) > 0 ? ", " : "", message ); @@ -1959,14 +1959,14 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_nodiscard_function(const zend_functio int code = fbc->type == ZEND_INTERNAL_FUNCTION ? E_WARNING : E_USER_WARNING; if (fbc->common.scope) { - zend_error_unchecked(code, "The return value of method %s::%s() should either be used or intentionally ignored by casting it as (void)%S", - ZSTR_VAL(fbc->common.scope->name), - ZSTR_VAL(fbc->common.function_name), + zend_error(code, "The return value of method %pS::%pS() should either be used or intentionally ignored by casting it as (void)%pS", + fbc->common.scope->name, + fbc->common.function_name, message_suffix ); } else { - zend_error_unchecked(code, "The return value of function %s() should either be used or intentionally ignored by casting it as (void)%S", - ZSTR_VAL(fbc->common.function_name), + zend_error(code, "The return value of function %pS() should either be used or intentionally ignored by casting it as (void)%pS", + fbc->common.function_name, message_suffix ); } @@ -1985,10 +1985,10 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_deprecated_class_constant(const zend_ int code = c->ce->type == ZEND_INTERNAL_CLASS ? E_DEPRECATED : E_USER_DEPRECATED; char *type = (ZEND_CLASS_CONST_FLAGS(c) & ZEND_CLASS_CONST_IS_CASE) ? "Enum case" : "Constant"; - zend_error_unchecked(code, "%s %s::%s is deprecated%S", + zend_error(code, "%s %pS::%pS is deprecated%pS", type, - ZSTR_VAL(c->ce->name), - ZSTR_VAL(constant_name), + c->ce->name, + constant_name, message_suffix ); @@ -2005,8 +2005,8 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_deprecated_constant(const zend_consta int code = ZEND_CONSTANT_MODULE_NUMBER(c) == PHP_USER_CONSTANT ? E_USER_DEPRECATED : E_DEPRECATED; - zend_error_unchecked(code, "Constant %s is deprecated%S", - ZSTR_VAL(constant_name), + zend_error(code, "Constant %pS is deprecated%pS", + constant_name, message_suffix ); @@ -2025,9 +2025,9 @@ ZEND_API ZEND_COLD void zend_use_of_deprecated_trait( int code = trait->type == ZEND_INTERNAL_CLASS ? E_DEPRECATED : E_USER_DEPRECATED; - zend_error_unchecked(code, "Trait %s used by %s is deprecated%S", - ZSTR_VAL(trait->name), - ZSTR_VAL(used_by), + zend_error(code, "Trait %pS used by %pS is deprecated%pS", + trait->name, + used_by, message_suffix ); @@ -2194,18 +2194,18 @@ static zend_never_inline ZEND_COLD zend_long zend_throw_incdec_ref_error(const z zend_string *type_str = zend_type_to_string(error_prop->type); if (ZEND_IS_INCREMENT(opline->opcode)) { zend_type_error( - "Cannot increment a reference held by property %s::$%s of type %s past its maximal value", - ZSTR_VAL(error_prop->ce->name), + "Cannot increment a reference held by property %pS::$%s of type %pS past its maximal value", + error_prop->ce->name, zend_get_unmangled_property_name(error_prop->name), - ZSTR_VAL(type_str)); + type_str); zend_string_release(type_str); return ZEND_LONG_MAX; } else { zend_type_error( - "Cannot decrement a reference held by property %s::$%s of type %s past its minimal value", - ZSTR_VAL(error_prop->ce->name), + "Cannot decrement a reference held by property %pS::$%s of type %pS past its minimal value", + error_prop->ce->name, zend_get_unmangled_property_name(error_prop->name), - ZSTR_VAL(type_str)); + type_str); zend_string_release(type_str); return ZEND_LONG_MIN; } @@ -2214,17 +2214,17 @@ static zend_never_inline ZEND_COLD zend_long zend_throw_incdec_ref_error(const z static zend_never_inline ZEND_COLD zend_long zend_throw_incdec_prop_error(const zend_property_info *prop OPLINE_DC) { zend_string *type_str = zend_type_to_string(prop->type); if (ZEND_IS_INCREMENT(opline->opcode)) { - zend_type_error("Cannot increment property %s::$%s of type %s past its maximal value", - ZSTR_VAL(prop->ce->name), + zend_type_error("Cannot increment property %pS::$%s of type %pS past its maximal value", + prop->ce->name, zend_get_unmangled_property_name(prop->name), - ZSTR_VAL(type_str)); + type_str); zend_string_release(type_str); return ZEND_LONG_MAX; } else { - zend_type_error("Cannot decrement property %s::$%s of type %s past its minimal value", - ZSTR_VAL(prop->ce->name), + zend_type_error("Cannot decrement property %pS::$%s of type %pS past its minimal value", + prop->ce->name, zend_get_unmangled_property_name(prop->name), - ZSTR_VAL(type_str)); + type_str); zend_string_release(type_str); return ZEND_LONG_MIN; } @@ -2504,7 +2504,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_undefined_offset(zend static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_undefined_index(const zend_string *offset) { - zend_error(E_WARNING, "Undefined array key \"%s\"", ZSTR_VAL(offset)); + zend_error(E_WARNING, "Undefined array key \"%pS\"", offset); } ZEND_API ZEND_COLD zval* ZEND_FASTCALL zend_undefined_offset_write(HashTable *ht, zend_long lval) @@ -2555,31 +2555,31 @@ ZEND_API ZEND_COLD zval* ZEND_FASTCALL zend_undefined_index_write(HashTable *ht, ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_undefined_method(const zend_class_entry *ce, const zend_string *method) { - zend_throw_error(NULL, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), ZSTR_VAL(method)); + zend_throw_error(NULL, "Call to undefined method %pS::%pS()", ce->name, method); } static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_invalid_method_call(const zval *object, const zval *function_name) { - zend_throw_error(NULL, "Call to a member function %s() on %s", - Z_STRVAL_P(function_name), zend_zval_value_name(object)); + zend_throw_error(NULL, "Call to a member function %pS() on %s", + Z_STR_P(function_name), zend_zval_value_name(object)); } ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_non_static_method_call(const zend_function *fbc) { zend_throw_error( zend_ce_error, - "Non-static method %s::%s() cannot be called statically", - ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); + "Non-static method %pS::%pS() cannot be called statically", + fbc->common.scope->name, fbc->common.function_name); } ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(const zend_function *func, uint32_t arg_num) { const char *arg_name = get_function_arg_name(func, arg_num); - zend_error(E_WARNING, "%s%s%s(): Argument #%d%s%s%s must be passed by reference, value given", + zend_error(E_WARNING, "%s%s%pS(): Argument #%d%s%s%s must be passed by reference, value given", func->common.scope ? ZSTR_VAL(func->common.scope->name) : "", func->common.scope ? "::" : "", - ZSTR_VAL(func->common.function_name), + func->common.function_name, arg_num, arg_name ? " ($" : "", arg_name ? arg_name : "", @@ -2972,7 +2972,7 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval * zend_class_entry *ce = obj->ce; ZVAL_NULL(result); - zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ZSTR_VAL(ce->name)); + zend_error(E_NOTICE, "Indirect modification of overloaded element of %pS has no effect", ce->name); } else if (EXPECTED(retval && Z_TYPE_P(retval) != IS_UNDEF)) { if (!Z_ISREF_P(retval)) { if (result != retval) { @@ -2981,7 +2981,7 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval * } if (Z_TYPE_P(retval) != IS_OBJECT) { zend_class_entry *ce = obj->ce; - zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ZSTR_VAL(ce->name)); + zend_error(E_NOTICE, "Indirect modification of overloaded element of %pS has no effect", ce->name); } } else if (UNEXPECTED(Z_REFCOUNT_P(retval) == 1)) { ZVAL_UNREF(retval); @@ -3087,7 +3087,7 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, c if (IS_LONG == is_numeric_string_ex(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL, /* allow errors */ true, NULL, &trailing_data)) { if (UNEXPECTED(trailing_data)) { - zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim)); + zend_error(E_WARNING, "Illegal string offset \"%pS\"", Z_STR_P(dim)); } goto out; } @@ -3833,8 +3833,8 @@ static zend_always_inline zval* zend_fetch_static_property_address(zend_property if ((fetch_type == BP_VAR_R || fetch_type == BP_VAR_RW) && UNEXPECTED(Z_TYPE_P(result) == IS_UNDEF) && ZEND_TYPE_IS_SET(property_info->type)) { - zend_throw_error(NULL, "Typed static property %s::$%s must not be accessed before initialization", - ZSTR_VAL(property_info->ce->name), + zend_throw_error(NULL, "Typed static property %pS::$%s must not be accessed before initialization", + property_info->ce->name, zend_get_unmangled_property_name(property_info->name)); return NULL; } @@ -3902,14 +3902,14 @@ ZEND_API zval* ZEND_FASTCALL zend_fetch_static_property(zend_execute_data *ex, i ZEND_API zend_never_inline ZEND_COLD void zend_throw_ref_type_error_type(const zend_property_info *prop1, const zend_property_info *prop2, const zval *zv) { zend_string *type1_str = zend_type_to_string(prop1->type); zend_string *type2_str = zend_type_to_string(prop2->type); - zend_type_error("Reference with value of type %s held by property %s::$%s of type %s is not compatible with property %s::$%s of type %s", + zend_type_error("Reference with value of type %s held by property %pS::$%s of type %pS is not compatible with property %pS::$%s of type %pS", zend_zval_type_name(zv), - ZSTR_VAL(prop1->ce->name), + prop1->ce->name, zend_get_unmangled_property_name(prop1->name), - ZSTR_VAL(type1_str), - ZSTR_VAL(prop2->ce->name), + type1_str, + prop2->ce->name, zend_get_unmangled_property_name(prop2->name), - ZSTR_VAL(type2_str) + type2_str ); zend_string_release(type1_str); zend_string_release(type2_str); @@ -3917,11 +3917,11 @@ ZEND_API zend_never_inline ZEND_COLD void zend_throw_ref_type_error_type(const z ZEND_API zend_never_inline ZEND_COLD void zend_throw_ref_type_error_zval(const zend_property_info *prop, const zval *zv) { zend_string *type_str = zend_type_to_string(prop->type); - zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s", + zend_type_error("Cannot assign %s to reference held by property %pS::$%s of type %pS", zend_zval_value_name(zv), - ZSTR_VAL(prop->ce->name), + prop->ce->name, zend_get_unmangled_property_name(prop->name), - ZSTR_VAL(type_str) + type_str ); zend_string_release(type_str); } @@ -3929,14 +3929,14 @@ ZEND_API zend_never_inline ZEND_COLD void zend_throw_ref_type_error_zval(const z static zend_never_inline ZEND_COLD void zend_throw_conflicting_coercion_error(const zend_property_info *prop1, const zend_property_info *prop2, const zval *zv) { zend_string *type1_str = zend_type_to_string(prop1->type); zend_string *type2_str = zend_type_to_string(prop2->type); - zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s and property %s::$%s of type %s, as this would result in an inconsistent type conversion", + zend_type_error("Cannot assign %s to reference held by property %pS::$%s of type %pS and property %pS::$%s of type %pS, as this would result in an inconsistent type conversion", zend_zval_value_name(zv), - ZSTR_VAL(prop1->ce->name), + prop1->ce->name, zend_get_unmangled_property_name(prop1->name), - ZSTR_VAL(type1_str), - ZSTR_VAL(prop2->ce->name), + type1_str, + prop2->ce->name, zend_get_unmangled_property_name(prop2->name), - ZSTR_VAL(type2_str) + type2_str ); zend_string_release(type1_str); zend_string_release(type2_str); @@ -5162,7 +5162,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s lcname = zend_string_tolower(function); } if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) { - zend_throw_error(NULL, "Call to undefined function %s()", ZSTR_VAL(function)); + zend_throw_error(NULL, "Call to undefined function %pS()", function); zend_string_release_ex(lcname, 0); return NULL; } @@ -5211,7 +5211,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_object(zend_o } } } else { - zend_throw_error(NULL, "Object of type %s is not callable", ZSTR_VAL(function->ce->name)); + zend_throw_error(NULL, "Object of type %pS is not callable", function->ce->name); return NULL; } @@ -5407,7 +5407,7 @@ static zend_never_inline bool ZEND_FASTCALL zend_fe_reset_iterator(zval *array_p OBJ_RELEASE(&iter->std); } if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); + zend_throw_exception_ex(NULL, 0, "Object of type %pS did not create an Iterator", ce->name); } ZVAL_UNDEF(EX_VAR(opline->result.var)); return 1; @@ -5459,7 +5459,7 @@ static zend_always_inline zend_result _zend_quick_get_constant( if (!c) { if (!check_defined_only) { - zend_throw_error(NULL, "Undefined constant \"%s\"", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))); + zend_throw_error(NULL, "Undefined constant \"%pS\"", Z_STR_P(RT_CONSTANT(opline, opline->op2))); ZVAL_UNDEF(EX_VAR(opline->result.var)); } return FAILURE; @@ -5542,7 +5542,7 @@ zval * ZEND_FASTCALL zend_handle_named_arg( const zend_function *fbc = call->func; uint32_t arg_offset = zend_get_arg_offset_by_name(fbc, arg_name, cache_slot); if (UNEXPECTED(arg_offset == (uint32_t) -1)) { - zend_throw_error(NULL, "Unknown named parameter $%s", ZSTR_VAL(arg_name)); + zend_throw_error(NULL, "Unknown named parameter $%pS", arg_name); return NULL; } @@ -5556,8 +5556,8 @@ zval * ZEND_FASTCALL zend_handle_named_arg( arg = zend_hash_add_empty_element(call->extra_named_params, arg_name); if (!arg) { - zend_throw_error(NULL, "Named parameter $%s overwrites previous argument", - ZSTR_VAL(arg_name)); + zend_throw_error(NULL, "Named parameter $%pS overwrites previous argument", + arg_name); return NULL; } *arg_num_ptr = arg_offset + 1; @@ -5588,8 +5588,8 @@ zval * ZEND_FASTCALL zend_handle_named_arg( arg = ZEND_CALL_VAR_NUM(call, arg_offset); if (UNEXPECTED(!Z_ISUNDEF_P(arg))) { - zend_throw_error(NULL, "Named parameter $%s overwrites previous %s", - ZSTR_VAL(arg_name), Z_TYPE_P(arg) == _IS_PLACEHOLDER ? "placeholder" : "argument"); + zend_throw_error(NULL, "Named parameter $%pS overwrites previous %s", + arg_name, Z_TYPE_P(arg) == _IS_PLACEHOLDER ? "placeholder" : "argument"); return NULL; } } diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 83ba5e7490cf..2380418cd7bc 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -839,7 +839,7 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_ ZEND_ASSERT(error && "Should have error if not callable"); zend_string *callable_name = zend_get_callable_name_ex(&fci->function_name, fci->object); - zend_throw_error(NULL, "Invalid callback %s, %s", ZSTR_VAL(callable_name), error); + zend_throw_error(NULL, "Invalid callback %pS, %s", callable_name, error); efree(error); zend_string_release_ex(callable_name, 0); return SUCCESS; @@ -1713,11 +1713,11 @@ static ZEND_COLD void report_class_fetch_error(const zend_string *class_name, ui } if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_INTERFACE) { - zend_throw_or_error(fetch_type, NULL, "Interface \"%s\" not found", ZSTR_VAL(class_name)); + zend_throw_or_error(fetch_type, NULL, "Interface \"%pS\" not found", class_name); } else if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_TRAIT) { - zend_throw_or_error(fetch_type, NULL, "Trait \"%s\" not found", ZSTR_VAL(class_name)); + zend_throw_or_error(fetch_type, NULL, "Trait \"%pS\" not found", class_name); } else { - zend_throw_or_error(fetch_type, NULL, "Class \"%s\" not found", ZSTR_VAL(class_name)); + zend_throw_or_error(fetch_type, NULL, "Class \"%pS\" not found", class_name); } } diff --git a/Zend/zend_fibers.c b/Zend/zend_fibers.c index c91436050856..7af44effbe8c 100644 --- a/Zend/zend_fibers.c +++ b/Zend/zend_fibers.c @@ -1100,8 +1100,8 @@ ZEND_METHOD(FiberError, __construct) { zend_throw_error( NULL, - "The \"%s\" class is reserved for internal use and cannot be manually instantiated", - ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name) + "The \"%pS\" class is reserved for internal use and cannot be manually instantiated", + Z_OBJCE_P(ZEND_THIS)->name ); } diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 4424c9a1a3ab..ba9d2387201f 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -188,9 +188,9 @@ static void do_inherit_parent_constructor(zend_class_entry *ce) /* {{{ */ if (ce->constructor) { if (parent->constructor && UNEXPECTED(parent->constructor->common.fn_flags & ZEND_ACC_FINAL)) { - zend_error_noreturn(E_ERROR, "Cannot override final %s::__construct() with %s::__construct()", - ZSTR_VAL(parent->name), - ZSTR_VAL(ce->name)); + zend_error_noreturn(E_ERROR, "Cannot override final %pS::__construct() with %pS::__construct()", + parent->name, + ce->name); } return; } @@ -268,8 +268,8 @@ static zend_class_entry *lookup_class_ex( if (register_unresolved && !ce) { zend_error_noreturn( - E_COMPILE_ERROR, "%s must be registered before %s", - ZSTR_VAL(name), ZSTR_VAL(scope->name)); + E_COMPILE_ERROR, "%pS must be registered before %pS", + name, scope->name); } return ce; @@ -1064,8 +1064,8 @@ static void ZEND_COLD emit_incompatible_method_error( ZEND_ASSERT(unresolved_class); zend_error_at(E_COMPILE_ERROR, func_filename(child), func_lineno(child), - "Could not check compatibility between %s and %s, because class %s is not available", - ZSTR_VAL(child_prototype), ZSTR_VAL(parent_prototype), ZSTR_VAL(unresolved_class)); + "Could not check compatibility between %pS and %pS, because class %pS is not available", + child_prototype, parent_prototype, unresolved_class); } else if (status == INHERITANCE_WARNING) { const zend_attribute *return_type_will_change_attribute = zend_get_attribute_str( child->common.attributes, @@ -1075,15 +1075,15 @@ static void ZEND_COLD emit_incompatible_method_error( if (!return_type_will_change_attribute) { zend_error_at(E_DEPRECATED, func_filename(child), func_lineno(child), - "Return type of %s should either be compatible with %s, " + "Return type of %pS should either be compatible with %pS, " "or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice", - ZSTR_VAL(child_prototype), ZSTR_VAL(parent_prototype)); + child_prototype, parent_prototype); ZEND_ASSERT(!EG(exception)); } } else { zend_error_at(E_COMPILE_ERROR, func_filename(child), func_lineno(child), - "Declaration of %s must be compatible with %s", - ZSTR_VAL(child_prototype), ZSTR_VAL(parent_prototype)); + "Declaration of %pS must be compatible with %pS", + child_prototype, parent_prototype); } zend_string_efree(child_prototype); zend_string_efree(parent_prototype); @@ -1153,8 +1153,8 @@ static inheritance_status do_inheritance_check_on_method( return INHERITANCE_ERROR; } zend_error_at_noreturn(E_COMPILE_ERROR, func_filename(child), func_lineno(child), - "Cannot override final method %s::%s()", - ZEND_FN_SCOPE_NAME(parent), ZSTR_VAL(child->common.function_name)); + "Cannot override final method %s::%pS()", + ZEND_FN_SCOPE_NAME(parent), child->common.function_name); } child_flags = child->common.fn_flags; @@ -1167,12 +1167,12 @@ static inheritance_status do_inheritance_check_on_method( } if (child_flags & ZEND_ACC_STATIC) { zend_error_at_noreturn(E_COMPILE_ERROR, func_filename(child), func_lineno(child), - "Cannot make non static method %s::%s() static in class %s", - ZEND_FN_SCOPE_NAME(parent), ZSTR_VAL(child->common.function_name), ZEND_FN_SCOPE_NAME(child)); + "Cannot make non static method %s::%pS() static in class %s", + ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); } else { zend_error_at_noreturn(E_COMPILE_ERROR, func_filename(child), func_lineno(child), - "Cannot make static method %s::%s() non static in class %s", - ZEND_FN_SCOPE_NAME(parent), ZSTR_VAL(child->common.function_name), ZEND_FN_SCOPE_NAME(child)); + "Cannot make static method %s::%pS() non static in class %s", + ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); } } @@ -1183,8 +1183,8 @@ static inheritance_status do_inheritance_check_on_method( return INHERITANCE_ERROR; } zend_error_at_noreturn(E_COMPILE_ERROR, func_filename(child), func_lineno(child), - "Cannot make non abstract method %s::%s() abstract in class %s", - ZEND_FN_SCOPE_NAME(parent), ZSTR_VAL(child->common.function_name), ZEND_FN_SCOPE_NAME(child)); + "Cannot make non abstract method %s::%pS() abstract in class %s", + ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child)); } if ((flags & ZEND_INHERITANCE_SET_CHILD_CHANGED) @@ -1218,8 +1218,8 @@ static inheritance_status do_inheritance_check_on_method( return INHERITANCE_ERROR; } zend_error_at_noreturn(E_COMPILE_ERROR, func_filename(child), func_lineno(child), - "Access level to %s::%s() must be %s (as in class %s)%s", - ZEND_FN_SCOPE_NAME(child), ZSTR_VAL(child->common.function_name), zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); + "Access level to %s::%pS() must be %s (as in class %s)%s", + ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); } if (flags & ZEND_INHERITANCE_CHECK_PROTO) { @@ -1305,13 +1305,13 @@ static ZEND_COLD void emit_incompatible_property_error( const zend_property_info *child, const zend_property_info *parent, prop_variance variance) { zend_string *type_str = zend_type_to_string_resolved(parent->type, parent->ce); zend_error_noreturn(E_COMPILE_ERROR, - "Type of %s::$%s must be %s%s (as in class %s)", - ZSTR_VAL(child->ce->name), + "Type of %pS::$%s must be %s%pS (as in class %pS)", + child->ce->name, zend_get_unmangled_property_name(child->name), variance == PROP_INVARIANT ? "" : variance == PROP_COVARIANT ? "subtype of " : "supertype of ", - ZSTR_VAL(type_str), - ZSTR_VAL(parent->ce->name)); + type_str, + parent->ce->name); } static ZEND_COLD void emit_set_hook_type_error(const zend_property_info *child, const zend_property_info *parent) @@ -1319,12 +1319,12 @@ static ZEND_COLD void emit_set_hook_type_error(const zend_property_info *child, zend_type set_type = parent->hooks[ZEND_PROPERTY_HOOK_SET]->common.arg_info[0].type; zend_string *type_str = zend_type_to_string_resolved(set_type, parent->ce); zend_error_noreturn(E_COMPILE_ERROR, - "Set type of %s::$%s must be supertype of %s (as in %s %s)", - ZSTR_VAL(child->ce->name), + "Set type of %pS::$%s must be supertype of %pS (as in %s %pS)", + child->ce->name, zend_get_unmangled_property_name(child->name), - ZSTR_VAL(type_str), + type_str, zend_get_object_type_case(parent->ce, false), - ZSTR_VAL(parent->ce->name)); + parent->ce->name); } static inheritance_status verify_property_type_compatibility( @@ -1409,9 +1409,9 @@ static void inherit_property_hook( if (parent_flags & ZEND_ACC_FINAL) { zend_error_noreturn(E_COMPILE_ERROR, - "Cannot override final property hook %s::%s()", - ZSTR_VAL(parent->common.scope->name), - ZSTR_VAL(parent->common.function_name)); + "Cannot override final property hook %pS::%pS()", + parent->common.scope->name, + parent->common.function_name); } do_inheritance_check_on_method( @@ -1448,8 +1448,8 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke child_info->flags |= ZEND_ACC_CHANGED; } if (parent_info->flags & ZEND_ACC_FINAL) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot override final property %s::$%s", - ZSTR_VAL(parent_info->ce->name), ZSTR_VAL(key)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot override final property %pS::$%pS", + parent_info->ce->name, key); } if (!(parent_info->flags & ZEND_ACC_PRIVATE)) { if (!(parent_info->ce->ce_flags & ZEND_ACC_INTERFACE)) { @@ -1457,18 +1457,18 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke } if (UNEXPECTED((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC))) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s%s::$%s as %s%s::$%s", - (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ZSTR_VAL(parent_info->ce->name), ZSTR_VAL(key), - (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ZSTR_VAL(ce->name), ZSTR_VAL(key)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s%pS::$%pS as %s%pS::$%pS", + (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_info->ce->name, key, + (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name, key); } if (UNEXPECTED((child_info->flags & ZEND_ACC_READONLY) != (parent_info->flags & ZEND_ACC_READONLY))) { if (!(parent_info->flags & ZEND_ACC_ABSTRACT)) { zend_error_noreturn(E_COMPILE_ERROR, - "Cannot redeclare %s property %s::$%s as %s %s::$%s", + "Cannot redeclare %s property %pS::$%pS as %s %pS::$%pS", parent_info->flags & ZEND_ACC_READONLY ? "readonly" : "non-readonly", - ZSTR_VAL(parent_info->ce->name), ZSTR_VAL(key), + parent_info->ce->name, key, child_info->flags & ZEND_ACC_READONLY ? "readonly" : "non-readonly", - ZSTR_VAL(ce->name), ZSTR_VAL(key)); + ce->name, key); } } if (UNEXPECTED((child_info->flags & ZEND_ACC_PPP_SET_MASK)) @@ -1484,15 +1484,15 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke if (child_set_visibility > parent_set_visibility) { zend_error_noreturn( E_COMPILE_ERROR, - "Set access level of %s::$%s must be %s (as in class %s)%s", - ZSTR_VAL(ce->name), ZSTR_VAL(key), - zend_asymmetric_visibility_string(parent_info->flags), ZSTR_VAL(parent_info->ce->name), + "Set access level of %pS::$%pS must be %s (as in class %pS)%s", + ce->name, key, + zend_asymmetric_visibility_string(parent_info->flags), parent_info->ce->name, !(parent_info->flags & ZEND_ACC_PPP_SET_MASK) ? "" : " or weaker"); } } if (UNEXPECTED((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK))) { - zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ZSTR_VAL(ce->name), ZSTR_VAL(key), zend_visibility_string(parent_info->flags), ZSTR_VAL(parent_info->ce->name), (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); + zend_error_noreturn(E_COMPILE_ERROR, "Access level to %pS::$%pS must be %s (as in class %pS)%s", ce->name, key, zend_visibility_string(parent_info->flags), parent_info->ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); } if (!(child_info->flags & ZEND_ACC_STATIC) && !(parent_info->flags & ZEND_ACC_VIRTUAL)) { /* If we added hooks to the child property, we use the child's slot for @@ -1550,10 +1550,10 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke } } else if (UNEXPECTED(ZEND_TYPE_IS_SET(child_info->type) && !ZEND_TYPE_IS_SET(parent_info->type))) { zend_error_noreturn(E_COMPILE_ERROR, - "Type of %s::$%s must be omitted to match the parent definition in class %s", - ZSTR_VAL(ce->name), - ZSTR_VAL(key), - ZSTR_VAL(parent_info->ce->name)); + "Type of %pS::$%pS must be omitted to match the parent definition in class %pS", + ce->name, + key, + parent_info->ce->name); } if (child_info->ce == ce) { @@ -1577,7 +1577,7 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface) /* {{{ */ { if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce) == FAILURE) { - zend_error_noreturn(E_CORE_ERROR, "%s %s could not implement interface %s", zend_get_object_type_uc(ce), ZSTR_VAL(ce->name), ZSTR_VAL(iface->name)); + zend_error_noreturn(E_CORE_ERROR, "%s %pS could not implement interface %pS", zend_get_object_type_uc(ce), ce->name, iface->name); } /* This should be prevented by the class lookup logic. */ ZEND_ASSERT(ce != iface); @@ -1618,12 +1618,12 @@ static void emit_incompatible_class_constant_error( const zend_class_constant *child, const zend_class_constant *parent, const zend_string *const_name) { zend_string *type_str = zend_type_to_string_resolved(parent->type, parent->ce); zend_error_noreturn(E_COMPILE_ERROR, - "Type of %s::%s must be compatible with %s::%s of type %s", - ZSTR_VAL(child->ce->name), - ZSTR_VAL(const_name), - ZSTR_VAL(parent->ce->name), - ZSTR_VAL(const_name), - ZSTR_VAL(type_str)); + "Type of %pS::%pS must be compatible with %pS::%pS of type %pS", + child->ce->name, + const_name, + parent->ce->name, + const_name, + type_str); } static inheritance_status class_constant_types_compatible(const zend_class_constant *parent, const zend_class_constant *child) @@ -1739,7 +1739,7 @@ ZEND_API void zend_verify_hooked_property(const zend_class_entry *ce, zend_prope prop_info->offset = ZEND_VIRTUAL_PROPERTY_OFFSET; } else { zend_error_noreturn(E_COMPILE_ERROR, - "Cannot specify default value for virtual hooked property %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(prop_name)); + "Cannot specify default value for virtual hooked property %pS::$%pS", ce->name, prop_name); } } /* If the property turns backed during inheritance and no type and default value are set, we want @@ -1756,8 +1756,8 @@ ZEND_API void zend_verify_hooked_property(const zend_class_entry *ce, zend_prope && (func->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) && !(prop_info->flags & ZEND_ACC_VIRTUAL) && prop_info->hooks[ZEND_PROPERTY_HOOK_SET]) { - zend_error_noreturn(E_COMPILE_ERROR, "Get hook of backed property %s::%s with set hook may not return by reference", - ZSTR_VAL(ce->name), ZSTR_VAL(prop_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Get hook of backed property %pS::%pS with set hook may not return by reference", + ce->name, prop_name); } if (func->common.fn_flags & ZEND_ACC_ABSTRACT) { abstract_error = false; @@ -1766,7 +1766,7 @@ ZEND_API void zend_verify_hooked_property(const zend_class_entry *ce, zend_prope } if (abstract_error) { zend_error_noreturn(E_COMPILE_ERROR, - "Abstract property %s::$%s must specify at least one abstract hook", ZSTR_VAL(ce->name), ZSTR_VAL(prop_name)); + "Abstract property %pS::$%pS must specify at least one abstract hook", ce->name, prop_name); } if ((prop_info->flags & ZEND_ACC_VIRTUAL) && (prop_info->flags & ZEND_ACC_PPP_SET_MASK) @@ -1774,15 +1774,15 @@ ZEND_API void zend_verify_hooked_property(const zend_class_entry *ce, zend_prope const char *prefix = !prop_info->hooks[ZEND_PROPERTY_HOOK_GET] ? "set-only" : "get-only"; zend_error_noreturn(E_COMPILE_ERROR, - "%s virtual property %s::$%s must not specify asymmetric visibility", - prefix, ZSTR_VAL(ce->name), ZSTR_VAL(prop_name)); + "%s virtual property %pS::$%pS must not specify asymmetric visibility", + prefix, ce->name, prop_name); } } ZEND_API ZEND_COLD ZEND_NORETURN void zend_hooked_property_variance_error_ex(zend_string *value_param_name, zend_string *class_name, zend_string *prop_name) { - zend_error_noreturn(E_COMPILE_ERROR, "Type of parameter $%s of hook %s::$%s::set must be compatible with property type", - ZSTR_VAL(value_param_name), ZSTR_VAL(class_name), zend_get_unmangled_property_name(prop_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Type of parameter $%pS of hook %pS::$%s::set must be compatible with property type", + value_param_name, class_name, zend_get_unmangled_property_name(prop_name)); } ZEND_API ZEND_COLD ZEND_NORETURN void zend_hooked_property_variance_error(const zend_property_info *prop_info) @@ -1837,31 +1837,31 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par if (UNEXPECTED(ce->ce_flags & ZEND_ACC_INTERFACE)) { /* Interface can only inherit other interfaces */ if (UNEXPECTED(!(parent_ce->ce_flags & ZEND_ACC_INTERFACE))) { - zend_error_noreturn(E_COMPILE_ERROR, "Interface %s cannot extend class %s", ZSTR_VAL(ce->name), ZSTR_VAL(parent_ce->name)); + zend_error_noreturn(E_COMPILE_ERROR, "Interface %pS cannot extend class %pS", ce->name, parent_ce->name); } } else if (UNEXPECTED(parent_ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_FINAL|ZEND_ACC_ENUM))) { /* Class must not extend an enum (GH-16315); check enums first since * enums are implemented as final classes */ if (parent_ce->ce_flags & ZEND_ACC_ENUM) { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend enum %s", ZSTR_VAL(ce->name), ZSTR_VAL(parent_ce->name)); + zend_error_noreturn(E_COMPILE_ERROR, "Class %pS cannot extend enum %pS", ce->name, parent_ce->name); } /* Class must not extend a final class */ if (parent_ce->ce_flags & ZEND_ACC_FINAL) { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend final class %s", ZSTR_VAL(ce->name), ZSTR_VAL(parent_ce->name)); + zend_error_noreturn(E_COMPILE_ERROR, "Class %pS cannot extend final class %pS", ce->name, parent_ce->name); } /* Class declaration must not extend traits or interfaces */ if ((parent_ce->ce_flags & ZEND_ACC_INTERFACE) || (parent_ce->ce_flags & ZEND_ACC_TRAIT)) { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend %s %s", - ZSTR_VAL(ce->name), parent_ce->ce_flags & ZEND_ACC_INTERFACE ? "interface" : "trait", ZSTR_VAL(parent_ce->name) + zend_error_noreturn(E_COMPILE_ERROR, "Class %pS cannot extend %s %pS", + ce->name, parent_ce->ce_flags & ZEND_ACC_INTERFACE ? "interface" : "trait", parent_ce->name ); } } if (UNEXPECTED((ce->ce_flags & ZEND_ACC_READONLY_CLASS) != (parent_ce->ce_flags & ZEND_ACC_READONLY_CLASS))) { - zend_error_noreturn(E_COMPILE_ERROR, "%s class %s cannot extend %s class %s", - ce->ce_flags & ZEND_ACC_READONLY_CLASS ? "Readonly" : "Non-readonly", ZSTR_VAL(ce->name), - parent_ce->ce_flags & ZEND_ACC_READONLY_CLASS ? "readonly" : "non-readonly", ZSTR_VAL(parent_ce->name) + zend_error_noreturn(E_COMPILE_ERROR, "%s class %pS cannot extend %s class %pS", + ce->ce_flags & ZEND_ACC_READONLY_CLASS ? "Readonly" : "Non-readonly", ce->name, + parent_ce->ce_flags & ZEND_ACC_READONLY_CLASS ? "readonly" : "non-readonly", parent_ce->name ); } @@ -2090,27 +2090,27 @@ static bool do_inherit_constant_check( zend_class_constant *child_constant = Z_PTR_P(zv); if (parent_constant->ce != child_constant->ce && (ZEND_CLASS_CONST_FLAGS(parent_constant) & ZEND_ACC_FINAL)) { - zend_error_noreturn(E_COMPILE_ERROR, "%s::%s cannot override final constant %s::%s", - ZSTR_VAL(child_constant->ce->name), ZSTR_VAL(name), - ZSTR_VAL(parent_constant->ce->name), ZSTR_VAL(name) + zend_error_noreturn(E_COMPILE_ERROR, "%pS::%pS cannot override final constant %pS::%pS", + child_constant->ce->name, name, + parent_constant->ce->name, name ); } if (child_constant->ce != parent_constant->ce && child_constant->ce != ce) { zend_error_noreturn(E_COMPILE_ERROR, - "%s %s inherits both %s::%s and %s::%s, which is ambiguous", + "%s %pS inherits both %pS::%pS and %pS::%pS, which is ambiguous", zend_get_object_type_uc(ce), - ZSTR_VAL(ce->name), - ZSTR_VAL(child_constant->ce->name), ZSTR_VAL(name), - ZSTR_VAL(parent_constant->ce->name), ZSTR_VAL(name)); + ce->name, + child_constant->ce->name, name, + parent_constant->ce->name, name); } if (UNEXPECTED((ZEND_CLASS_CONST_FLAGS(child_constant) & ZEND_ACC_PPP_MASK) > (ZEND_CLASS_CONST_FLAGS(parent_constant) & ZEND_ACC_PPP_MASK))) { - zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s must be %s (as in %s %s)%s", - ZSTR_VAL(ce->name), ZSTR_VAL(name), + zend_error_noreturn(E_COMPILE_ERROR, "Access level to %pS::%pS must be %s (as in %s %pS)%s", + ce->name, name, zend_visibility_string(ZEND_CLASS_CONST_FLAGS(parent_constant)), zend_get_object_type(parent_constant->ce), - ZSTR_VAL(parent_constant->ce->name), + parent_constant->ce->name, (ZEND_CLASS_CONST_FLAGS(parent_constant) & ZEND_ACC_PUBLIC) ? "" : " or weaker" ); } @@ -2219,7 +2219,7 @@ ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry if (EXPECTED(i < parent_iface_num)) { ignore = true; } else { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot implement previously implemented interface %s", ZSTR_VAL(ce->name), ZSTR_VAL(iface->name)); + zend_error_noreturn(E_COMPILE_ERROR, "Class %pS cannot implement previously implemented interface %pS", ce->name, iface->name); } } } @@ -2256,16 +2256,16 @@ static void zend_do_implement_interfaces(zend_class_entry *ce, zend_class_entry } if (UNEXPECTED(!(iface->ce_flags & ZEND_ACC_INTERFACE))) { efree(interfaces); - zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ZSTR_VAL(ce->name), ZSTR_VAL(iface->name)); + zend_error_noreturn(E_ERROR, "%pS cannot implement %pS - it is not an interface", ce->name, iface->name); } for (uint32_t j = 0; j < num_interfaces; j++) { if (interfaces[j] == iface) { if (j >= num_parent_interfaces) { efree(interfaces); - zend_error_noreturn(E_COMPILE_ERROR, "%s %s cannot implement previously implemented interface %s", + zend_error_noreturn(E_COMPILE_ERROR, "%s %pS cannot implement previously implemented interface %pS", zend_get_object_type_uc(ce), - ZSTR_VAL(ce->name), - ZSTR_VAL(iface->name)); + ce->name, + iface->name); } /* skip duplications */ ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(&iface->constants_table, key, c) { @@ -2318,8 +2318,8 @@ void zend_inheritance_check_override(const zend_class_entry *ce) zend_error_at_noreturn( E_COMPILE_ERROR, f->op_array.filename, f->op_array.line_start, - "%s::%s() has #[\\Override] attribute, but no matching parent method exists", - ZEND_FN_SCOPE_NAME(f), ZSTR_VAL(f->common.function_name)); + "%s::%pS() has #[\\Override] attribute, but no matching parent method exists", + ZEND_FN_SCOPE_NAME(f), f->common.function_name); } } ZEND_HASH_FOREACH_END(); @@ -2327,8 +2327,8 @@ void zend_inheritance_check_override(const zend_class_entry *ce) if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_OVERRIDE) { zend_error_noreturn( E_COMPILE_ERROR, - "%s::%s has #[\\Override] attribute, but no matching parent constant exists", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + "%pS::%pS has #[\\Override] attribute, but no matching parent constant exists", + ce->name, name); } } ZEND_HASH_FOREACH_END(); @@ -2336,8 +2336,8 @@ void zend_inheritance_check_override(const zend_class_entry *ce) if (prop->flags & ZEND_ACC_OVERRIDE) { zend_error_noreturn( E_COMPILE_ERROR, - "%s::$%s has #[\\Override] attribute, but no matching parent property exists", - ZSTR_VAL(ce->name), zend_get_unmangled_property_name(prop->name)); + "%pS::$%s has #[\\Override] attribute, but no matching parent property exists", + ce->name, zend_get_unmangled_property_name(prop->name)); } if (prop->hooks) { @@ -2348,8 +2348,8 @@ void zend_inheritance_check_override(const zend_class_entry *ce) zend_error_at_noreturn( E_COMPILE_ERROR, f->op_array.filename, f->op_array.line_start, - "%s::%s() has #[\\Override] attribute, but no matching parent method exists", - ZEND_FN_SCOPE_NAME(f), ZSTR_VAL(f->common.function_name)); + "%s::%pS() has #[\\Override] attribute, but no matching parent method exists", + ZEND_FN_SCOPE_NAME(f), f->common.function_name); } } } @@ -2396,10 +2396,10 @@ static void zend_add_trait_method(zend_class_entry *ce, zend_string *name, zend_ } else if (UNEXPECTED((existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT) && !(existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT))) { /* two traits can't define the same non-abstract method */ - zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s::%s has not been applied as %s::%s, because of collision with %s::%s", - ZSTR_VAL(fn->common.scope->name), ZSTR_VAL(fn->common.function_name), - ZSTR_VAL(ce->name), ZSTR_VAL(name), - ZSTR_VAL(existing_fn->common.scope->name), ZSTR_VAL(existing_fn->common.function_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Trait method %pS::%pS has not been applied as %pS::%pS, because of collision with %pS::%pS", + fn->common.scope->name, fn->common.function_name, + ce->name, name, + existing_fn->common.scope->name, existing_fn->common.function_name); } } @@ -2528,7 +2528,7 @@ static void zend_traits_copy_functions(zend_string *fnname, zend_function *fn, z static uint32_t zend_check_trait_usage(const zend_class_entry *ce, const zend_class_entry *trait, zend_class_entry **traits) /* {{{ */ { if (UNEXPECTED((trait->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT)) { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s is not a trait, Only traits may be used in 'as' and 'insteadof' statements", ZSTR_VAL(trait->name)); + zend_error_noreturn(E_COMPILE_ERROR, "Class %pS is not a trait, Only traits may be used in 'as' and 'insteadof' statements", trait->name); } for (uint32_t i = 0; i < ce->num_traits; i++) { @@ -2536,7 +2536,7 @@ static uint32_t zend_check_trait_usage(const zend_class_entry *ce, const zend_cl return i; } } - zend_error_noreturn(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", ZSTR_VAL(trait->name), ZSTR_VAL(ce->name)); + zend_error_noreturn(E_COMPILE_ERROR, "Required Trait %pS wasn't added to %pS", trait->name, ce->name); } /* }}} */ @@ -2561,7 +2561,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce, zend_class_e cur_method_ref = &cur_precedence->trait_method; trait = zend_hash_find_ptr_lc(EG(class_table), cur_method_ref->class_name); if (!trait || !(trait->ce_flags & ZEND_ACC_LINKED)) { - zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", ZSTR_VAL(cur_method_ref->class_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %pS", cur_method_ref->class_name); } zend_check_trait_usage(ce, trait, traits); @@ -2569,9 +2569,9 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce, zend_class_e lcname = zend_string_tolower(cur_method_ref->method_name); if (!zend_hash_exists(&trait->function_table, lcname)) { zend_error_noreturn(E_COMPILE_ERROR, - "A precedence rule was defined for %s::%s but this method does not exist", - ZSTR_VAL(trait->name), - ZSTR_VAL(cur_method_ref->method_name)); + "A precedence rule was defined for %pS::%pS but this method does not exist", + trait->name, + cur_method_ref->method_name); } /** With the other traits, we are more permissive. @@ -2588,7 +2588,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce, zend_class_e exclude_ce = zend_hash_find_ptr_lc(EG(class_table), class_name); if (!exclude_ce || !(exclude_ce->ce_flags & ZEND_ACC_LINKED)) { - zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", ZSTR_VAL(class_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %pS", class_name); } trait_num = zend_check_trait_usage(ce, exclude_ce, traits); if (!exclude_tables[trait_num]) { @@ -2596,7 +2596,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce, zend_class_e zend_hash_init(exclude_tables[trait_num], 0, NULL, NULL, 0); } if (zend_hash_add_empty_element(exclude_tables[trait_num], lcname) == NULL) { - zend_error_noreturn(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", ZSTR_VAL(precedences[i]->trait_method.method_name), ZSTR_VAL(exclude_ce->name)); + zend_error_noreturn(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%pS). Method of trait %pS was defined to be excluded multiple times", precedences[i]->trait_method.method_name, exclude_ce->name); } /* make sure that the trait method is not from a class mentioned in @@ -2604,10 +2604,10 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce, zend_class_e if (trait == exclude_ce) { zend_error_noreturn(E_COMPILE_ERROR, "Inconsistent insteadof definition. " - "The method %s is to be used from %s, but %s is also on the exclude list", - ZSTR_VAL(cur_method_ref->method_name), - ZSTR_VAL(trait->name), - ZSTR_VAL(trait->name)); + "The method %pS is to be used from %pS, but %pS is also on the exclude list", + cur_method_ref->method_name, + trait->name, + trait->name); } } zend_string_release_ex(lcname, 0); @@ -2631,14 +2631,14 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce, zend_class_e /* For all aliases with an explicit class name, resolve the class now. */ trait = zend_hash_find_ptr_lc(EG(class_table), cur_method_ref->class_name); if (!trait || !(trait->ce_flags & ZEND_ACC_LINKED)) { - zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", ZSTR_VAL(cur_method_ref->class_name)); + zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %pS", cur_method_ref->class_name); } zend_check_trait_usage(ce, trait, traits); aliases[i] = trait; /* And, ensure that the referenced method is resolvable, too. */ if (!zend_hash_exists(&trait->function_table, lcname)) { - zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", ZSTR_VAL(trait->name), ZSTR_VAL(cur_method_ref->method_name)); + zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %pS::%pS but this method does not exist", trait->name, cur_method_ref->method_name); } } else { /* Find out which trait this method refers to. */ @@ -2652,11 +2652,11 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce, zend_class_e } zend_error_noreturn(E_COMPILE_ERROR, - "An alias was defined for method %s(), which exists in both %s and %s. Use %s::%s or %s::%s to resolve the ambiguity", - ZSTR_VAL(cur_method_ref->method_name), - ZSTR_VAL(trait->name), ZSTR_VAL(traits[j]->name), - ZSTR_VAL(trait->name), ZSTR_VAL(cur_method_ref->method_name), - ZSTR_VAL(traits[j]->name), ZSTR_VAL(cur_method_ref->method_name)); + "An alias was defined for method %pS(), which exists in both %pS and %pS. Use %pS::%pS or %pS::%pS to resolve the ambiguity", + cur_method_ref->method_name, + trait->name, traits[j]->name, + trait->name, cur_method_ref->method_name, + traits[j]->name, cur_method_ref->method_name); } } } @@ -2665,13 +2665,13 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce, zend_class_e if (!trait) { if (cur_alias->alias) { zend_error_noreturn(E_COMPILE_ERROR, - "An alias (%s) was defined for method %s(), but this method does not exist", - ZSTR_VAL(cur_alias->alias), - ZSTR_VAL(cur_alias->trait_method.method_name)); + "An alias (%pS) was defined for method %pS(), but this method does not exist", + cur_alias->alias, + cur_alias->trait_method.method_name); } else { zend_error_noreturn(E_COMPILE_ERROR, - "The modifiers of the trait method %s() are changed, but this method does not exist. Error", - ZSTR_VAL(cur_alias->trait_method.method_name)); + "The modifiers of the trait method %pS() are changed, but this method does not exist. Error", + cur_alias->trait_method.method_name); } } @@ -2757,11 +2757,11 @@ static void emit_incompatible_trait_constant_error( zend_class_entry **traits, size_t current_trait ) { zend_error_noreturn(E_COMPILE_ERROR, - "%s and %s define the same constant (%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed", - ZSTR_VAL(find_first_constant_definition(ce, traits, current_trait, name, existing_constant->ce)->name), - ZSTR_VAL(trait_constant->ce->name), - ZSTR_VAL(name), - ZSTR_VAL(ce->name) + "%pS and %pS define the same constant (%pS) in the composition of %pS. However, the definition differs and is considered incompatible. Class was composed", + find_first_constant_definition(ce, traits, current_trait, name, existing_constant->ce)->name, + trait_constant->ce->name, + name, + ce->name ); } @@ -2769,12 +2769,12 @@ static void emit_trait_constant_enum_case_conflict_error( const zend_class_entry *ce, const zend_class_constant *trait_constant, zend_string *name ) { zend_error_noreturn(E_COMPILE_ERROR, - "Cannot use trait %s, because %s::%s conflicts with enum case %s::%s", - ZSTR_VAL(trait_constant->ce->name), - ZSTR_VAL(trait_constant->ce->name), - ZSTR_VAL(name), - ZSTR_VAL(ce->name), - ZSTR_VAL(name) + "Cannot use trait %pS, because %pS::%pS conflicts with enum case %pS::%pS", + trait_constant->ce->name, + trait_constant->ce->name, + name, + ce->name, + name ); } @@ -2914,11 +2914,11 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent if (colliding_prop->hooks || property_info->hooks) { zend_error_noreturn(E_COMPILE_ERROR, - "%s and %s define the same hooked property ($%s) in the composition of %s. Conflict resolution between hooked properties is currently not supported. Class was composed", - ZSTR_VAL(find_first_property_definition(ce, traits, i, prop_name, colliding_prop->ce)->name), - ZSTR_VAL(property_info->ce->name), - ZSTR_VAL(prop_name), - ZSTR_VAL(ce->name)); + "%pS and %pS define the same hooked property ($%pS) in the composition of %pS. Conflict resolution between hooked properties is currently not supported. Class was composed", + find_first_property_definition(ce, traits, i, prop_name, colliding_prop->ce)->name, + property_info->ce->name, + prop_name, + ce->name); } if ((colliding_prop->flags & flags_mask) == (flags & flags_mask) && @@ -2941,11 +2941,11 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent if (!is_compatible) { zend_error_noreturn(E_COMPILE_ERROR, - "%s and %s define the same property ($%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed", - ZSTR_VAL(find_first_property_definition(ce, traits, i, prop_name, colliding_prop->ce)->name), - ZSTR_VAL(property_info->ce->name), - ZSTR_VAL(prop_name), - ZSTR_VAL(ce->name)); + "%pS and %pS define the same property ($%pS) in the composition of %pS. However, the definition differs and is considered incompatible. Class was composed", + find_first_property_definition(ce, traits, i, prop_name, colliding_prop->ce)->name, + property_info->ce->name, + prop_name, + ce->name); } continue; } @@ -2953,10 +2953,10 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent if ((ce->ce_flags & ZEND_ACC_READONLY_CLASS) && !(property_info->flags & ZEND_ACC_READONLY)) { zend_error_noreturn(E_COMPILE_ERROR, - "Readonly class %s cannot use trait with a non-readonly property %s::$%s", - ZSTR_VAL(ce->name), - ZSTR_VAL(property_info->ce->name), - ZSTR_VAL(prop_name) + "Readonly class %pS cannot use trait with a non-readonly property %pS::$%pS", + ce->name, + property_info->ce->name, + prop_name ); } @@ -3042,8 +3042,8 @@ ZEND_API void zend_class_use_internal_traits(zend_class_entry *class_entry, int if (UNEXPECTED(!(trait_entry->ce_flags & ZEND_ACC_TRAIT))) { free(traits); - zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot use %s - it is not a trait", - ZSTR_VAL(class_entry->name), ZSTR_VAL(trait_entry->name)); + zend_error_noreturn(E_COMPILE_ERROR, "Class %pS cannot use %pS - it is not a trait", + class_entry->name, trait_entry->name); } traits[i] = trait_entry; } @@ -3120,9 +3120,9 @@ void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */ if (ai.cnt) { if (!is_explicit_abstract && can_be_abstract) { zend_error_noreturn(E_ERROR, - "%s %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")", + "%s %pS contains %d abstract method%s and must therefore be declared abstract or implement the remaining method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")", zend_get_object_type_uc(ce), - ZSTR_VAL(ce->name), ai.cnt, + ce->name, ai.cnt, ai.cnt > 1 ? "s" : "", ai.cnt > 1 ? "s" : "", DISPLAY_ABSTRACT_FN(0), @@ -3131,9 +3131,9 @@ void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */ ); } else { zend_error_noreturn(E_ERROR, - "%s %s must implement %d abstract method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")", + "%s %pS must implement %d abstract method%s (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")", zend_get_object_type_uc(ce), - ZSTR_VAL(ce->name), ai.cnt, + ce->name, ai.cnt, ai.cnt > 1 ? "s" : "", DISPLAY_ABSTRACT_FN(0), DISPLAY_ABSTRACT_FN(1), @@ -3340,8 +3340,8 @@ static void load_delayed_classes(const zend_class_entry *ce) { zend_string_release(name); if (EG(exception)) { zend_exception_uncaught_error( - "During inheritance of %s, while autoloading %s", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + "During inheritance of %pS, while autoloading %pS", + ce->name, name); } } } @@ -3374,7 +3374,7 @@ static void check_unrecoverable_load_failure(const zend_class_entry *ce) { if (CG(unlinked_uses) && zend_hash_index_del(CG(unlinked_uses), (zend_ulong)(uintptr_t)ce) == SUCCESS) { zend_exception_uncaught_error( - "During inheritance of %s with variance dependencies", ZSTR_VAL(ce->name)); + "During inheritance of %pS with variance dependencies", ce->name); } } @@ -3576,7 +3576,7 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string return NULL; } if (UNEXPECTED(!(trait->ce_flags & ZEND_ACC_TRAIT))) { - zend_throw_error(NULL, "%s cannot use %s - it is not a trait", ZSTR_VAL(ce->name), ZSTR_VAL(trait->name)); + zend_throw_error(NULL, "%pS cannot use %pS - it is not a trait", ce->name, trait->name); free_alloca(traits_and_interfaces, use_heap); return NULL; } diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 093683526d31..21bd9d486a0b 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -653,8 +653,8 @@ static zend_ulong zend_ini_parse_quantity_internal(const zend_string *value, zen smart_str_append_escaped(&invalid, ZSTR_VAL(value), ZSTR_LEN(value)); smart_str_0(&invalid); - *errstr = zend_strpprintf(0, "Invalid quantity \"%s\": no valid leading digits, interpreting as \"0\" for backwards compatibility", - ZSTR_VAL(invalid.s)); + *errstr = zend_strpprintf(0, "Invalid quantity \"%pS\": no valid leading digits, interpreting as \"0\" for backwards compatibility", + invalid.s); smart_str_free(&invalid); return 0; @@ -702,8 +702,8 @@ static zend_ulong zend_ini_parse_quantity_internal(const zend_string *value, zen smart_str_append_escaped(&invalid, ZSTR_VAL(value), ZSTR_LEN(value)); smart_str_0(&invalid); - *errstr = zend_strpprintf(0, "Invalid quantity \"%s\": no digits after base prefix, interpreting as \"0\" for backwards compatibility", - ZSTR_VAL(invalid.s)); + *errstr = zend_strpprintf(0, "Invalid quantity \"%pS\": no digits after base prefix, interpreting as \"0\" for backwards compatibility", + invalid.s); smart_str_free(&invalid); return 0; @@ -744,8 +744,8 @@ static zend_ulong zend_ini_parse_quantity_internal(const zend_string *value, zen smart_str_append_escaped(&invalid, ZSTR_VAL(value), ZSTR_LEN(value)); smart_str_0(&invalid); - *errstr = zend_strpprintf(0, "Invalid quantity \"%s\": no valid leading digits, interpreting as \"0\" for backwards compatibility", - ZSTR_VAL(invalid.s)); + *errstr = zend_strpprintf(0, "Invalid quantity \"%pS\": no valid leading digits, interpreting as \"0\" for backwards compatibility", + invalid.s); smart_str_free(&invalid); return 0; @@ -781,8 +781,8 @@ static zend_ulong zend_ini_parse_quantity_internal(const zend_string *value, zen smart_str_append_escaped(&chr, str_end-1, 1); smart_str_0(&chr); - *errstr = zend_strpprintf(0, "Invalid quantity \"%s\": unknown multiplier \"%s\", interpreting as \"%s\" for backwards compatibility", - ZSTR_VAL(invalid.s), ZSTR_VAL(chr.s), ZSTR_VAL(interpreted.s)); + *errstr = zend_strpprintf(0, "Invalid quantity \"%pS\": unknown multiplier \"%pS\", interpreting as \"%pS\" for backwards compatibility", + invalid.s, chr.s, interpreted.s); smart_str_free(&invalid); smart_str_free(&interpreted); @@ -815,8 +815,8 @@ static zend_ulong zend_ini_parse_quantity_internal(const zend_string *value, zen smart_str_append_escaped(&chr, str_end-1, 1); smart_str_0(&chr); - *errstr = zend_strpprintf(0, "Invalid quantity \"%s\", interpreting as \"%s%s\" for backwards compatibility", - ZSTR_VAL(invalid.s), ZSTR_VAL(interpreted.s), ZSTR_VAL(chr.s)); + *errstr = zend_strpprintf(0, "Invalid quantity \"%pS\", interpreting as \"%pS%pS\" for backwards compatibility", + invalid.s, interpreted.s, chr.s); smart_str_free(&invalid); smart_str_free(&interpreted); @@ -833,8 +833,8 @@ static zend_ulong zend_ini_parse_quantity_internal(const zend_string *value, zen /* Not specifying the resulting value here because the caller may make * additional conversions. Not specifying the allowed range * because the caller may do narrower range checks. */ - *errstr = zend_strpprintf(0, "Invalid quantity \"%s\": value is out of range, using overflow result for backwards compatibility", - ZSTR_VAL(invalid.s)); + *errstr = zend_strpprintf(0, "Invalid quantity \"%pS\": value is out of range, using overflow result for backwards compatibility", + invalid.s); smart_str_free(&invalid); smart_str_free(&interpreted); @@ -866,7 +866,7 @@ ZEND_API zend_long zend_ini_parse_quantity_warn(const zend_string *value, zend_s zend_long retval = zend_ini_parse_quantity(value, &errstr); if (errstr) { - zend_error(E_WARNING, "Invalid \"%s\" setting. %s", ZSTR_VAL(setting), ZSTR_VAL(errstr)); + zend_error(E_WARNING, "Invalid \"%pS\" setting. %pS", setting, errstr); zend_string_release(errstr); } @@ -880,7 +880,7 @@ ZEND_API zend_ulong zend_ini_parse_uquantity_warn(const zend_string *value, zend zend_ulong retval = zend_ini_parse_uquantity(value, &errstr); if (errstr) { - zend_error(E_WARNING, "Invalid \"%s\" setting. %s", ZSTR_VAL(setting), ZSTR_VAL(errstr)); + zend_error(E_WARNING, "Invalid \"%pS\" setting. %pS", setting, errstr); zend_string_release(errstr); } diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 49169dfca234..109766e4f093 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -57,7 +57,7 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z &obj_ce->function_table, function_name, function_name_len); if (UNEXPECTED(fn == NULL)) { /* error at c-level */ - zend_error_noreturn(E_CORE_ERROR, "Couldn't find implementation for method %s::%s", ZSTR_VAL(obj_ce->name), function_name); + zend_error_noreturn(E_CORE_ERROR, "Couldn't find implementation for method %pS::%s", obj_ce->name, function_name); } } else { fn = zend_fetch_function_str(function_name, function_name_len); @@ -243,7 +243,7 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c if (!ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && Z_OBJ(iterator) == Z_OBJ_P(object))) { if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce ? ZSTR_VAL(ce->name) : ZSTR_VAL(Z_OBJCE_P(object)->name)); + zend_throw_exception_ex(NULL, 0, "Objects returned by %pS::getIterator() must be traversable or implement interface Iterator", ce ? ce->name : Z_OBJCE_P(object)->name); } zval_ptr_dtor(&iterator); return NULL; @@ -273,12 +273,12 @@ static int zend_implement_traversable(zend_class_entry *interface, zend_class_en } } } - zend_error_noreturn(E_CORE_ERROR, "%s %s must implement interface %s as part of either %s or %s", + zend_error_noreturn(E_CORE_ERROR, "%s %pS must implement interface %pS as part of either %pS or %pS", zend_get_object_type_uc(class_type), - ZSTR_VAL(class_type->name), - ZSTR_VAL(zend_ce_traversable->name), - ZSTR_VAL(zend_ce_iterator->name), - ZSTR_VAL(zend_ce_aggregate->name)); + class_type->name, + zend_ce_traversable->name, + zend_ce_iterator->name, + zend_ce_aggregate->name); return FAILURE; } /* }}} */ @@ -288,8 +288,8 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr { if (zend_class_implements_interface(class_type, zend_ce_iterator)) { zend_error_noreturn(E_ERROR, - "Class %s cannot implement both Iterator and IteratorAggregate at the same time", - ZSTR_VAL(class_type->name)); + "Class %pS cannot implement both Iterator and IteratorAggregate at the same time", + class_type->name); } /* Always initialize iterator_funcs_ptr. */ @@ -330,8 +330,8 @@ static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry { if (zend_class_implements_interface(class_type, zend_ce_aggregate)) { zend_error_noreturn(E_ERROR, - "Class %s cannot implement both Iterator and IteratorAggregate at the same time", - ZSTR_VAL(class_type->name)); + "Class %pS cannot implement both Iterator and IteratorAggregate at the same time", + class_type->name); } ZEND_ASSERT(!class_type->iterator_funcs_ptr && "Iterator funcs already set?"); @@ -431,7 +431,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b } if (result == FAILURE && !EG(exception)) { - zend_throw_exception_ex(NULL, 0, "%s::serialize() must return a string or NULL", ZSTR_VAL(ce->name)); + zend_throw_exception_ex(NULL, 0, "%pS::serialize() must return a string or NULL", ce->name); } return result; } @@ -475,10 +475,10 @@ static int zend_implement_serializable(zend_class_entry *interface, zend_class_e } if (!(class_type->ce_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS) && (!class_type->__serialize || !class_type->__unserialize)) { - zend_error(E_DEPRECATED, "%s implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)", ZSTR_VAL(class_type->name)); + zend_error(E_DEPRECATED, "%pS implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)", class_type->name); if (EG(exception)) { zend_exception_uncaught_error( - "During inheritance of %s, while implementing Serializable", ZSTR_VAL(class_type->name)); + "During inheritance of %pS, while implementing Serializable", class_type->name); } } return SUCCESS; diff --git a/Zend/zend_lazy_objects.c b/Zend/zend_lazy_objects.c index a8316768ef5f..0e8a587f6ca9 100644 --- a/Zend/zend_lazy_objects.c +++ b/Zend/zend_lazy_objects.c @@ -234,14 +234,14 @@ ZEND_API zend_object *zend_object_make_lazy(zend_object *obj, /* Internal classes are not supported */ if (UNEXPECTED(reflection_ce->type == ZEND_INTERNAL_CLASS && reflection_ce != zend_standard_class_def)) { - zend_throw_error(NULL, "Cannot make instance of internal class lazy: %s is internal", ZSTR_VAL(reflection_ce->name)); + zend_throw_error(NULL, "Cannot make instance of internal class lazy: %pS is internal", reflection_ce->name); return NULL; } for (zend_class_entry *parent = reflection_ce->parent; parent; parent = parent->parent) { if (UNEXPECTED(parent->type == ZEND_INTERNAL_CLASS && parent != zend_standard_class_def)) { - zend_throw_error(NULL, "Cannot make instance of internal class lazy: %s inherits internal class %s", - ZSTR_VAL(reflection_ce->name), ZSTR_VAL(parent->name)); + zend_throw_error(NULL, "Cannot make instance of internal class lazy: %pS inherits internal class %pS", + reflection_ce->name, parent->name); return NULL; } } @@ -513,17 +513,17 @@ static zend_object *zend_lazy_object_init_proxy(zend_object *obj) } if (UNEXPECTED(Z_TYPE(retval) != IS_OBJECT)) { - zend_type_error("Lazy proxy factory must return an instance of a class compatible with %s, %s returned", - ZSTR_VAL(obj->ce->name), + zend_type_error("Lazy proxy factory must return an instance of a class compatible with %pS, %s returned", + obj->ce->name, zend_zval_value_name(&retval)); zval_ptr_dtor(&retval); goto fail; } if (UNEXPECTED(Z_TYPE(retval) != IS_OBJECT || !zend_lazy_object_compatible(Z_OBJ(retval), obj))) { - zend_type_error("The real instance class %s is not compatible with the proxy class %s. The proxy must be a instance of the same class as the real instance, or a sub-class with no additional properties, and no overrides of the __destructor or __clone methods.", + zend_type_error("The real instance class %s is not compatible with the proxy class %pS. The proxy must be a instance of the same class as the real instance, or a sub-class with no additional properties, and no overrides of the __destructor or __clone methods.", zend_zval_value_name(&retval), - ZSTR_VAL(obj->ce->name)); + obj->ce->name); zval_ptr_dtor(&retval); goto fail; } diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index e06287895d15..68ad2303c418 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -224,8 +224,8 @@ ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp) / return Z_ARRVAL(retval); } } else if (Z_TYPE(retval) == IS_NULL) { - zend_error(E_DEPRECATED, "Returning null from %s::__debugInfo() is deprecated, return an empty array instead", - ZSTR_VAL(ce->name)); + zend_error(E_DEPRECATED, "Returning null from %pS::__debugInfo() is deprecated, return an empty array instead", + ce->name); *is_temp = 1; ht = zend_new_array(0); return ht; @@ -313,7 +313,7 @@ static zend_never_inline zend_property_info *zend_get_parent_private_property(co static ZEND_COLD zend_never_inline void zend_bad_property_access(const zend_property_info *property_info, const zend_class_entry *ce, const zend_string *member) /* {{{ */ { - zend_throw_error(NULL, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ZSTR_VAL(ce->name), ZSTR_VAL(member)); + zend_throw_error(NULL, "Cannot access %s property %pS::$%pS", zend_visibility_string(property_info->flags), ce->name, member); } /* }}} */ @@ -325,22 +325,22 @@ static ZEND_COLD zend_never_inline void zend_bad_property_name(void) /* {{{ */ static ZEND_COLD zend_never_inline void zend_forbidden_dynamic_property( const zend_class_entry *ce, const zend_string *member) { - zend_throw_error(NULL, "Cannot create dynamic property %s::$%s", - ZSTR_VAL(ce->name), ZSTR_VAL(member)); + zend_throw_error(NULL, "Cannot create dynamic property %pS::$%pS", + ce->name, member); } static ZEND_COLD zend_never_inline bool zend_deprecated_dynamic_property( zend_object *obj, const zend_string *member) { GC_ADDREF(obj); - zend_error(E_DEPRECATED, "Creation of dynamic property %s::$%s is deprecated", - ZSTR_VAL(obj->ce->name), ZSTR_VAL(member)); + zend_error(E_DEPRECATED, "Creation of dynamic property %pS::$%pS is deprecated", + obj->ce->name, member); if (UNEXPECTED(GC_DELREF(obj) == 0)) { const zend_class_entry *ce = obj->ce; zend_objects_store_del(obj); if (!EG(exception)) { /* We cannot continue execution and have to throw an exception */ - zend_throw_error(NULL, "Cannot create dynamic property %s::$%s", - ZSTR_VAL(ce->name), ZSTR_VAL(member)); + zend_throw_error(NULL, "Cannot create dynamic property %pS::$%pS", + ce->name, member); } return 0; } @@ -349,8 +349,8 @@ static ZEND_COLD zend_never_inline bool zend_deprecated_dynamic_property( static ZEND_COLD zend_never_inline void zend_readonly_property_unset_error( const zend_class_entry *ce, const zend_string *member) { - zend_throw_error(NULL, "Cannot unset readonly property %s::$%s", - ZSTR_VAL(ce->name), ZSTR_VAL(member)); + zend_throw_error(NULL, "Cannot unset readonly property %pS::$%pS", + ce->name, member); } static zend_always_inline const zend_class_entry *get_fake_or_executed_scope(void) @@ -435,7 +435,7 @@ static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *c found: if (UNEXPECTED(flags & ZEND_ACC_STATIC)) { if (!silent) { - zend_error(E_NOTICE, "Accessing static property %s::$%s as non static", ZSTR_VAL(ce->name), ZSTR_VAL(member)); + zend_error(E_NOTICE, "Accessing static property %pS::$%pS as non static", ce->name, member); } return ZEND_DYNAMIC_PROPERTY_OFFSET; } @@ -530,7 +530,7 @@ ZEND_API zend_property_info *zend_get_property_info(const zend_class_entry *ce, found: if (UNEXPECTED(flags & ZEND_ACC_STATIC)) { if (!silent) { - zend_error(E_NOTICE, "Accessing static property %s::$%s as non static", ZSTR_VAL(ce->name), ZSTR_VAL(member)); + zend_error(E_NOTICE, "Accessing static property %pS::$%pS as non static", ce->name, member); } } return property_info; @@ -688,9 +688,9 @@ static zend_always_inline zend_object *zend_lazy_proxy_get_guarded_instance( ZEND_COLD static void zend_typed_property_uninitialized_access(const zend_property_info *prop_info, zend_string *name) { - zend_throw_error(NULL, "Typed property %s::$%s must not be accessed before initialization", - ZSTR_VAL(prop_info->ce->name), - ZSTR_VAL(name)); + zend_throw_error(NULL, "Typed property %pS::$%pS must not be accessed before initialization", + prop_info->ce->name, + name); } static ZEND_FUNCTION(zend_parent_hook_get_trampoline); @@ -731,9 +731,9 @@ static bool zend_should_call_hook(const zend_property_info *prop_info, const zen static ZEND_COLD void zend_throw_no_prop_backing_value_access(const zend_string *class_name, const zend_string *prop_name, bool is_read) { - zend_throw_error(NULL, "Must not %s virtual property %s::$%s", + zend_throw_error(NULL, "Must not %s virtual property %pS::$%pS", is_read ? "read from" : "write to", - ZSTR_VAL(class_name), ZSTR_VAL(prop_name)); + class_name, prop_name); } static bool zend_call_get_hook( @@ -762,7 +762,7 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int uint32_t *guard = NULL; #if DEBUG_OBJECT_HANDLERS - fprintf(stderr, "Read object #%d property: %s\n", zobj->handle, ZSTR_VAL(name)); + fprintf(stderr, "Read object #%d property: %pS\n", zobj->handle, name); #endif /* make zend_get_property_info silent if we have getter - we may want to use it */ @@ -832,8 +832,8 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int zend_function *get = prop_info->hooks[ZEND_PROPERTY_HOOK_GET]; if (!get) { if (prop_info->flags & ZEND_ACC_VIRTUAL) { - zend_throw_error(NULL, "Cannot read from set-only virtual property %s::$%s", - ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); + zend_throw_error(NULL, "Cannot read from set-only virtual property %pS::$%pS", + zobj->ce->name, name); return &EG(uninitialized_zval); } /* Cache the fact that this hook has trivial read. This only applies to @@ -850,8 +850,8 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int if (UNEXPECTED(type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET)) { if (UNEXPECTED(Z_TYPE_P(retval) != IS_OBJECT)) { - zend_throw_error(NULL, "Indirect modification of %s::$%s is not allowed", - ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); + zend_throw_error(NULL, "Indirect modification of %pS::$%pS is not allowed", + zobj->ce->name, name); goto exit; } ZVAL_COPY(rv, retval); @@ -894,8 +894,8 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int if (!Z_ISREF_P(rv) && (type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET) && UNEXPECTED(Z_TYPE_P(rv) != IS_OBJECT)) { - zend_throw_error(NULL, "Indirect modification of %s::$%s is not allowed", - ZSTR_VAL(ce->name), ZSTR_VAL(name)); + zend_throw_error(NULL, "Indirect modification of %pS::$%pS is not allowed", + ce->name, name); } } else { retval = &EG(uninitialized_zval); @@ -999,7 +999,7 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int if (!Z_ISREF_P(rv) && (type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET)) { if (UNEXPECTED(Z_TYPE_P(rv) != IS_OBJECT)) { - zend_error(E_NOTICE, "Indirect modification of overloaded property %s::$%s has no effect", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); + zend_error(E_NOTICE, "Indirect modification of overloaded property %pS::$%pS has no effect", zobj->ce->name, name); } } } else { @@ -1051,7 +1051,7 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int if (prop_info) { zend_typed_property_uninitialized_access(prop_info, name); } else { - zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); + zend_error(E_WARNING, "Undefined property: %pS::$%pS", zobj->ce->name, name); } } retval = &EG(uninitialized_zval); @@ -1226,7 +1226,7 @@ found:; if (!set) { if (prop_info->flags & ZEND_ACC_VIRTUAL) { - zend_throw_error(NULL, "Cannot write to get-only virtual property %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); + zend_throw_error(NULL, "Cannot write to get-only virtual property %pS::$%pS", zobj->ce->name, name); variable_ptr = &EG(error_zval); goto exit; } @@ -1357,7 +1357,7 @@ found:; static ZEND_COLD zend_never_inline void zend_bad_array_access(const zend_class_entry *ce) /* {{{ */ { - zend_throw_error(NULL, "Cannot use object of type %s as array", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot use object of type %pS as array", ce->name); } /* }}} */ @@ -1400,7 +1400,7 @@ ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int ty if (UNEXPECTED(Z_TYPE_P(rv) == IS_UNDEF)) { if (UNEXPECTED(!EG(exception))) { - zend_throw_error(NULL, "Undefined offset for object of type %s used as array", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Undefined offset for object of type %pS used as array", ce->name); } return NULL; } @@ -1473,7 +1473,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam ZEND_ASSERT(type != BP_VAR_R && type != BP_VAR_IS); #if DEBUG_OBJECT_HANDLERS - fprintf(stderr, "Ptr object #%d property: %s\n", zobj->handle, ZSTR_VAL(name)); + fprintf(stderr, "Ptr object #%d property: %pS\n", zobj->handle, name); #endif property_offset = zend_get_property_offset(zobj->ce, name, (zobj->ce->__get != NULL), cache_slot, &prop_info); @@ -1510,7 +1510,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam zend_typed_property_uninitialized_access(prop_info, name); retval = &EG(error_zval); } else { - zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); + zend_error(E_WARNING, "Undefined property: %pS::$%pS", zobj->ce->name, name); /* An error handler may set the property */ if (EXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { ZVAL_NULL(retval); @@ -1578,7 +1578,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam rebuild_object_properties_internal(zobj); } if (UNEXPECTED(type == BP_VAR_RW)) { - zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); + zend_error(E_WARNING, "Undefined property: %pS::$%pS", zobj->ce->name, name); } retval = zend_hash_add(zobj->properties, name, &EG(uninitialized_zval)); } @@ -1673,8 +1673,8 @@ ZEND_API void zend_std_unset_property(zend_object *zobj, zend_string *name, void return; } } else if (IS_HOOKED_PROPERTY_OFFSET(property_offset)) { - zend_throw_error(NULL, "Cannot unset hooked property %s::$%s", - ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); + zend_throw_error(NULL, "Cannot unset hooked property %pS::$%pS", + zobj->ce->name, name); return; } else if (UNEXPECTED(EG(exception))) { return; @@ -1961,8 +1961,8 @@ ZEND_API zend_function *zend_get_property_hook_trampoline( ZEND_API ZEND_COLD zend_never_inline void zend_bad_method_call(const zend_function *fbc, const zend_string *method_name, const zend_class_entry *scope) /* {{{ */ { - zend_throw_error(NULL, "Call to %s method %s::%s() from %s%s", - zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(method_name), + zend_throw_error(NULL, "Call to %s method %s::%pS() from %s%s", + zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, scope ? "scope " : "global scope", scope ? ZSTR_VAL(scope->name) : "" ); @@ -1971,8 +1971,8 @@ ZEND_API ZEND_COLD zend_never_inline void zend_bad_method_call(const zend_functi ZEND_API ZEND_COLD zend_never_inline void zend_abstract_method_call(const zend_function *fbc) /* {{{ */ { - zend_throw_error(NULL, "Cannot call abstract method %s::%s()", - ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); + zend_throw_error(NULL, "Cannot call abstract method %pS::%pS()", + fbc->common.scope->name, fbc->common.function_name); } /* }}} */ @@ -2103,9 +2103,9 @@ ZEND_API zend_function *zend_std_get_static_method(const zend_class_entry *ce, z goto fail; } else if (UNEXPECTED(fbc->common.scope->ce_flags & ZEND_ACC_TRAIT)) { zend_error(E_DEPRECATED, - "Calling static trait method %s::%s is deprecated, " + "Calling static trait method %pS::%pS is deprecated, " "it should only be called on a class using the trait", - ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); + fbc->common.scope->name, fbc->common.function_name); if (EG(exception)) { goto fail; } @@ -2173,7 +2173,7 @@ ZEND_API zval *zend_std_get_static_property_with_info(zend_class_entry *ce, zend if (UNEXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) { undeclared_property: if (type != BP_VAR_IS) { - zend_throw_error(NULL, "Access to undeclared static property %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(property_name)); + zend_throw_error(NULL, "Access to undeclared static property %pS::$%pS", ce->name, property_name); } return NULL; } @@ -2194,16 +2194,16 @@ ZEND_API zval *zend_std_get_static_property_with_info(zend_class_entry *ce, zend if (UNEXPECTED((type == BP_VAR_R || type == BP_VAR_RW) && Z_TYPE_P(ret) == IS_UNDEF && ZEND_TYPE_IS_SET(property_info->type))) { - zend_throw_error(NULL, "Typed static property %s::$%s must not be accessed before initialization", - ZSTR_VAL(property_info->ce->name), ZSTR_VAL(property_name)); + zend_throw_error(NULL, "Typed static property %pS::$%pS must not be accessed before initialization", + property_info->ce->name, property_name); return NULL; } if (UNEXPECTED(ce->ce_flags & ZEND_ACC_TRAIT)) { zend_error(E_DEPRECATED, - "Accessing static trait property %s::$%s is deprecated, " + "Accessing static trait property %pS::$%pS is deprecated, " "it should only be accessed on a class using the trait", - ZSTR_VAL(property_info->ce->name), ZSTR_VAL(property_name)); + property_info->ce->name, property_name); } return ret; @@ -2218,22 +2218,22 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p ZEND_API ZEND_COLD void zend_std_unset_static_property(const zend_class_entry *ce, const zend_string *property_name) /* {{{ */ { - zend_throw_error(NULL, "Attempt to unset static property %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(property_name)); + zend_throw_error(NULL, "Attempt to unset static property %pS::$%pS", ce->name, property_name); } /* }}} */ static ZEND_COLD zend_never_inline void zend_bad_constructor_call(const zend_function *constructor, const zend_class_entry *scope) /* {{{ */ { if (scope) { - zend_throw_error(NULL, "Call to %s %s::__construct() from scope %s", + zend_throw_error(NULL, "Call to %s %pS::__construct() from scope %pS", zend_visibility_string(constructor->common.fn_flags), - ZSTR_VAL(constructor->common.scope->name), - ZSTR_VAL(scope->name) + constructor->common.scope->name, + scope->name ); } else { - zend_throw_error(NULL, "Call to %s %s::__construct() from global scope", + zend_throw_error(NULL, "Call to %s %pS::__construct() from global scope", zend_visibility_string(constructor->common.fn_flags), - ZSTR_VAL(constructor->common.scope->name) + constructor->common.scope->name ); } } @@ -2290,8 +2290,8 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */ if (Z_OBJ_HT_P(object)->cast_object(Z_OBJ_P(object), &casted, target_type) == FAILURE) { // TODO: Less crazy. if (target_type == IS_LONG || target_type == IS_DOUBLE) { - zend_error(E_NOTICE, "Object of class %s could not be converted to %s", - ZSTR_VAL(Z_OBJCE_P(object)->name), zend_get_type_by_const(target_type)); + zend_error(E_NOTICE, "Object of class %pS could not be converted to %s", + Z_OBJCE_P(object)->name, zend_get_type_by_const(target_type)); if (target_type == IS_LONG) { ZVAL_LONG(&casted, 1); } else { @@ -2472,8 +2472,8 @@ ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has if (!get) { if (prop_info->flags & ZEND_ACC_VIRTUAL) { - zend_throw_error(NULL, "Cannot read from set-only virtual property %s::$%s", - ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); + zend_throw_error(NULL, "Cannot read from set-only virtual property %pS::$%pS", + zobj->ce->name, name); return 0; } else { property_offset = prop_info->offset; @@ -2619,7 +2619,7 @@ ZEND_API zend_result zend_std_cast_object_tostring(zend_object *readobj, zval *w } zval_ptr_dtor(&retval); if (!EG(exception)) { - zend_throw_error(NULL, "Method %s::__toString() must return a string value", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Method %pS::__toString() must return a string value", ce->name); } } return FAILURE; diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 03ac5de67c78..7d8307fe2b9a 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -129,8 +129,8 @@ ZEND_API void zend_objects_destroy_object(zend_object *object) ZEND_ASSERT(!(destructor->common.fn_flags & ZEND_ACC_PUBLIC)); if (!zend_check_method_accessible(destructor, scope)) { zend_throw_error(NULL, - "Call to %s %s::__destruct() from %s%s", - zend_visibility_string(destructor->common.fn_flags), ZSTR_VAL(object->ce->name), + "Call to %s %pS::__destruct() from %s%s", + zend_visibility_string(destructor->common.fn_flags), object->ce->name, scope ? "scope " : "global scope", scope ? ZSTR_VAL(scope->name) : "" ); @@ -138,8 +138,8 @@ ZEND_API void zend_objects_destroy_object(zend_object *object) } } else { zend_error(E_WARNING, - "Call to %s %s::__destruct() from global scope during shutdown ignored", - zend_visibility_string(destructor->common.fn_flags), ZSTR_VAL(object->ce->name)); + "Call to %s %pS::__destruct() from global scope during shutdown ignored", + zend_visibility_string(destructor->common.fn_flags), object->ce->name); return; } } diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index ab8f2c2b54f8..225c4d95bdc3 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -232,7 +232,7 @@ ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, size_t str_len) ZVAL_UNDEF(dst); \ if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), dst, ctype) == FAILURE) { \ zend_error(E_WARNING, \ - "Object of class %s could not be converted to %s", ZSTR_VAL(Z_OBJCE_P(op)->name),\ + "Object of class %pS could not be converted to %s", Z_OBJCE_P(op)->name, \ zend_get_type_by_const(ctype)); \ } \ @@ -796,7 +796,7 @@ ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op) /* {{{ */ return; } if (!EG(exception)) { - zend_throw_error(NULL, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name)); + zend_throw_error(NULL, "Object of class %pS could not be converted to string", Z_OBJCE_P(op)->name); } zval_ptr_dtor(op); ZVAL_EMPTY_STRING(op); @@ -934,7 +934,7 @@ ZEND_API void ZEND_COLD zend_incompatible_double_to_long_error(double d) } ZEND_API void ZEND_COLD zend_incompatible_string_to_long_error(const zend_string *s) { - zend_error(E_DEPRECATED, "Implicit conversion from float-string \"%s\" to int loses precision", ZSTR_VAL(s)); + zend_error(E_DEPRECATED, "Implicit conversion from float-string \"%pS\" to int loses precision", s); } ZEND_API void ZEND_COLD zend_oob_double_to_long_error(double d) { @@ -942,7 +942,7 @@ ZEND_API void ZEND_COLD zend_oob_double_to_long_error(double d) } ZEND_API void ZEND_COLD zend_oob_string_to_long_error(const zend_string *s) { - zend_error_unchecked(E_WARNING, "The float-string \"%s\" is not representable as an int, cast occurred", ZSTR_VAL(s)); + zend_error(E_WARNING, "The float-string \"%pS\" is not representable as an int, cast occurred", s); } ZEND_API void ZEND_COLD zend_nan_coerced_to_type_warning(uint8_t type) @@ -1085,7 +1085,7 @@ static zend_always_inline zend_string* __zval_get_string_func(const zval *op, bo return Z_STR(tmp); } if (!EG(exception)) { - zend_throw_error(NULL, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name)); + zend_throw_error(NULL, "Object of class %pS could not be converted to string", Z_OBJCE_P(op)->name); } return try ? NULL : ZSTR_EMPTY_ALLOC(); } @@ -2911,7 +2911,7 @@ ZEND_API bool ZEND_FASTCALL zend_object_is_true(const zval *op) /* {{{ */ if (zobj->handlers->cast_object(zobj, &tmp, _IS_BOOL) == SUCCESS) { return Z_TYPE(tmp) == IS_TRUE; } - zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to bool", ZSTR_VAL(zobj->ce->name)); + zend_error(E_RECOVERABLE_ERROR, "Object of class %pS could not be converted to bool", zobj->ce->name); return false; } /* }}} */ diff --git a/Zend/zend_partial.c b/Zend/zend_partial.c index ec60383a2bc8..947771d81023 100644 --- a/Zend/zend_partial.c +++ b/Zend/zend_partial.c @@ -82,8 +82,8 @@ static zend_never_inline ZEND_COLD void zp_args_underflow( "exactly" : "at least"; zend_argument_count_error( - "Partial application of %s() expects %s %d arguments, %d given", - ZSTR_VAL(symbol), limit, expected, args); + "Partial application of %pS() expects %s %d arguments, %d given", + symbol, limit, expected, args); zend_string_release(symbol); } @@ -94,8 +94,8 @@ static zend_never_inline ZEND_COLD void zp_args_overflow( zend_string *symbol = get_function_or_method_name(function); zend_argument_count_error( - "Partial application of %s() expects at most %d arguments, %d given", - ZSTR_VAL(symbol), expected, args); + "Partial application of %pS() expects at most %d arguments, %d given", + symbol, expected, args); zend_string_release(symbol); } @@ -109,8 +109,8 @@ static zend_result zp_args_check(const zend_function *function, ZEND_HASH_MAP_FOREACH_STR_KEY_VAL(extra_named_args, zend_string *key, zval *arg) { if (UNEXPECTED(Z_IS_PLACEHOLDER_P(arg))) { zend_throw_error(NULL, - "Cannot use named placeholder for unknown or variadic parameter $%s", - ZSTR_VAL(key)); + "Cannot use named placeholder for unknown or variadic parameter $%pS", + key); return FAILURE; } } ZEND_HASH_FOREACH_END(); @@ -221,7 +221,7 @@ static zp_names *zp_assign_names(uint32_t argc, zval *argv, zend_string *orig_name = zp_get_func_param_name(function, function->common.num_args); zend_string *new_name; for (uint32_t n = 0;; n++) { - new_name = zend_strpprintf_unchecked(0, "%S%" PRIu32, orig_name, n); + new_name = zend_strpprintf(0, "%pS%" PRIu32, orig_name, n); if (!zp_name_exists(names, argc, new_name)) { break; } @@ -242,7 +242,7 @@ static zp_names *zp_assign_names(uint32_t argc, zval *argv, zend_string *new_name = zend_string_copy(orig_name); while (zp_name_exists(names, argc, new_name)) { zend_string_release(new_name); - new_name = zend_strpprintf_unchecked(0, "%S%" PRIu32, orig_name, n); + new_name = zend_strpprintf(0, "%pS%" PRIu32, orig_name, n); n++; } names->params[offset] = new_name; @@ -677,8 +677,7 @@ static zend_op_array *zp_compile(zval *this_ptr, zend_function *function, zend_op_array *op_array = NULL; if (UNEXPECTED(function->common.fn_flags2 & ZEND_ACC2_FORBID_DYN_CALLS)) { - const char *format = "Cannot call %S() dynamically"; - zend_throw_error(NULL, format, function->common.function_name); + zend_throw_error(NULL, "Cannot call %pS() dynamically", function->common.function_name); return NULL; } @@ -979,7 +978,7 @@ static zend_op_array *zp_compile(zval *this_ptr, zend_function *function, const char *tmp = getenv("DUMP_PFA_AST"); if (tmp && ZEND_ATOL(tmp)) { zend_string *str = zend_ast_export("", closure_ast, ""); - fprintf(stderr, "PFA AST: %s\n", ZSTR_VAL(str)); + fprintf(stderr, "PFA AST: %pS\n", str); zend_string_release(str); } } @@ -1082,8 +1081,8 @@ static void zp_bind(zval *result, zend_function *function, uint32_t argc, zval * zend_string *need_msg = zend_type_to_string_resolved(arg_info->type, function->common.scope); zend_argument_type_error_ex(function, offset + 1, - "must be of type %s, %s given", - ZSTR_VAL(need_msg), zend_zval_value_name(var)); + "must be of type %pS, %s given", + need_msg, zend_zval_value_name(var)); zend_string_release(need_msg); zval_ptr_dtor(result); ZVAL_NULL(result); diff --git a/Zend/zend_property_hooks.c b/Zend/zend_property_hooks.c index dd6fe95ef57a..ad99f622b9ff 100644 --- a/Zend/zend_property_hooks.c +++ b/Zend/zend_property_hooks.c @@ -166,8 +166,8 @@ static void zho_declared_it_fetch_current(zend_object_iterator *iter) if (hooked_iter->by_ref && (get == NULL || !(get->common.fn_flags & ZEND_ACC_RETURN_REFERENCE))) { - zend_throw_error(NULL, "Cannot create reference to property %s::$%s", - ZSTR_VAL(zobj->ce->name), zend_get_unmangled_property_name(prop_info->name)); + zend_throw_error(NULL, "Cannot create reference to property %pS::$%s", + zobj->ce->name, zend_get_unmangled_property_name(prop_info->name)); return; } zend_string *unmangled_name = prop_info->name; @@ -195,8 +195,8 @@ static void zho_declared_it_fetch_current(zend_object_iterator *iter) } else if (Z_TYPE_P(property) != IS_REFERENCE) { if (UNEXPECTED(prop_info->flags & ZEND_ACC_READONLY)) { zend_throw_error(NULL, - "Cannot acquire reference to readonly property %s::$%s", - ZSTR_VAL(prop_info->ce->name), zend_get_unmangled_property_name(prop_info->name)); + "Cannot acquire reference to readonly property %pS::$%s", + prop_info->ce->name, zend_get_unmangled_property_name(prop_info->name)); return; } ZVAL_MAKE_REF(property); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index d89d460d9d9d..21fbec1586c5 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1000,7 +1000,7 @@ ZEND_VM_COLD_HELPER(zend_undefined_function_helper, ANY, ANY) SAVE_OPLINE(); function_name = RT_CONSTANT(opline, opline->op2); - zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(function_name)); + zend_throw_error(NULL, "Call to undefined function %pS()", Z_STR_P(function_name)); HANDLE_EXCEPTION(); } @@ -1770,7 +1770,7 @@ ZEND_VM_C_LABEL(fetch_this): /* Keep name alive in case an error handler tries to free it. */ zend_string_addref(name); } - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval)); @@ -1793,7 +1793,7 @@ ZEND_VM_C_LABEL(fetch_this): } else if (type == BP_VAR_IS || type == BP_VAR_UNSET) { retval = &EG(uninitialized_zval); } else { - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { ZVAL_NULL(retval); @@ -3852,7 +3852,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR, HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -4030,7 +4030,7 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMP|CV, NUM) init_func_run_time_cache(&func->op_array); } } else { - zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error); + zend_type_error("%pS(): Argument #1 ($callback) must be a valid callback, %s", Z_STR_P(RT_CONSTANT(opline, opline->op1)), error); efree(error); FREE_OP2(); HANDLE_EXCEPTION(); @@ -5397,7 +5397,7 @@ ZEND_VM_C_LABEL(send_again): FREE_OP1(); if (!EG(exception)) { zend_throw_exception_ex( - NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name) + NULL, 0, "Object of type %pS did not create an Iterator", ce->name ); } HANDLE_EXCEPTION(); @@ -5459,11 +5459,11 @@ ZEND_VM_C_LABEL(send_again): if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) { zend_error( - E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()" + E_WARNING, "Cannot pass by-reference argument %d of %s%s%pS()" " by unpacking a Traversable, passing by-value instead", arg_num, EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - ZSTR_VAL(EX(call)->func->common.function_name) + EX(call)->func->common.function_name ); ZVAL_NEW_REF(top, arg); } else { @@ -5485,11 +5485,11 @@ ZEND_VM_C_LABEL(send_again): if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) { zend_error( - E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()" + E_WARNING, "Cannot pass by-reference argument %d of %s%s%pS()" " by unpacking a Traversable, passing by-value instead", arg_num, EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - ZSTR_VAL(EX(call)->func->common.function_name) + EX(call)->func->common.function_name ); ZVAL_NEW_REF(top, arg); } else { @@ -6110,7 +6110,7 @@ ZEND_VM_COLD_CONST_HANDLER(110, ZEND_CLONE, CONST|TMP|UNUSED|THIS|CV, ANY) clone = ce->clone; clone_call = zobj->handlers->clone_obj; if (UNEXPECTED(clone_call == NULL)) { - zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Trying to clone an uncloneable object of class %pS", ce->name); FREE_OP1(); ZVAL_UNDEF(EX_VAR(opline->result.var)); HANDLE_EXCEPTION(); @@ -6217,14 +6217,14 @@ ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, CO c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP2(); HANDLE_EXCEPTION(); } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP2(); HANDLE_EXCEPTION(); @@ -6268,8 +6268,8 @@ ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, CO CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP2(); HANDLE_EXCEPTION(); @@ -6456,7 +6456,7 @@ ZEND_VM_C_LABEL(add_unpack_again): FREE_OP1(); if (!EG(exception)) { zend_throw_exception_ex( - NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name) + NULL, 0, "Object of type %pS did not create an Iterator", ce->name ); } HANDLE_EXCEPTION(); @@ -7412,8 +7412,8 @@ ZEND_VM_HANDLER(126, ZEND_FE_FETCH_RW, VAR, ANY, JMP_ADDR) if (prop_info) { if (UNEXPECTED(prop_info->flags & ZEND_ACC_READONLY)) { zend_throw_error(NULL, - "Cannot acquire reference to readonly property %s::$%s", - ZSTR_VAL(prop_info->ce->name), ZSTR_VAL(p->key)); + "Cannot acquire reference to readonly property %pS::$%pS", + prop_info->ce->name, p->key); UNDEF_RESULT(); HANDLE_EXCEPTION(); } @@ -8642,7 +8642,7 @@ ZEND_VM_C_LABEL(yield_from_try_again): if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Object of type %pS did not create an Iterator", ce->name); } UNDEF_RESULT(); HANDLE_EXCEPTION(); @@ -8947,8 +8947,8 @@ ZEND_VM_HOT_HANDLER(211, ZEND_TYPE_ASSERT, CONST, ANY, NUM) if (!zend_check_type(&arginfo->type, value, /* is_return_type */ false, /* is_internal */ true)) { zend_string *expected = zend_type_to_string(arginfo->type); zend_argument_type_error_ex(fbc, argno, - "must be of type %s, %s given", - ZSTR_VAL(expected), zend_zval_value_name(value)); + "must be of type %pS, %s given", + expected, zend_zval_value_name(value)); zend_string_release(expected); } } @@ -10076,12 +10076,12 @@ ZEND_VM_HANDLER(209, ZEND_INIT_PARENT_PROPERTY_HOOK_CALL, CONST, UNUSED|NUM, NUM zend_property_info *prop_info = zend_hash_find_ptr(&parent_ce->properties_info, property_name); if (!prop_info) { - zend_throw_error(NULL, "Undefined property %s::$%s", ZSTR_VAL(parent_ce->name), ZSTR_VAL(property_name)); + zend_throw_error(NULL, "Undefined property %pS::$%pS", parent_ce->name, property_name); UNDEF_RESULT(); HANDLE_EXCEPTION(); } if (prop_info->flags & ZEND_ACC_PRIVATE) { - zend_throw_error(NULL, "Cannot access private property %s::$%s", ZSTR_VAL(parent_ce->name), ZSTR_VAL(property_name)); + zend_throw_error(NULL, "Cannot access private property %pS::$%pS", parent_ce->name, property_name); UNDEF_RESULT(); HANDLE_EXCEPTION(); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 4c830f203bfb..d7d6c0ff5fa6 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -773,7 +773,7 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_F SAVE_OPLINE(); function_name = RT_CONSTANT(opline, opline->op2); - zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(function_name)); + zend_throw_error(NULL, "Call to undefined function %pS()", Z_STR_P(function_name)); HANDLE_EXCEPTION(); } @@ -2524,7 +2524,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_SEND_UNPACK_S FREE_OP(opline->op1_type, opline->op1.var); if (!EG(exception)) { zend_throw_exception_ex( - NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name) + NULL, 0, "Object of type %pS did not create an Iterator", ce->name ); } HANDLE_EXCEPTION(); @@ -2586,11 +2586,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_SEND_UNPACK_S if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) { zend_error( - E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()" + E_WARNING, "Cannot pass by-reference argument %d of %s%s%pS()" " by unpacking a Traversable, passing by-value instead", arg_num, EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - ZSTR_VAL(EX(call)->func->common.function_name) + EX(call)->func->common.function_name ); ZVAL_NEW_REF(top, arg); } else { @@ -2612,11 +2612,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_SEND_UNPACK_S if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) { zend_error( - E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()" + E_WARNING, "Cannot pass by-reference argument %d of %s%s%pS()" " by unpacking a Traversable, passing by-value instead", arg_num, EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - ZSTR_VAL(EX(call)->func->common.function_name) + EX(call)->func->common.function_name ); ZVAL_NEW_REF(top, arg); } else { @@ -2913,7 +2913,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ADD_ARRAY_UNP FREE_OP(opline->op1_type, opline->op1.var); if (!EG(exception)) { zend_throw_exception_ex( - NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name) + NULL, 0, "Object of type %pS did not create an Iterator", ce->name ); } HANDLE_EXCEPTION(); @@ -5305,7 +5305,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ clone = ce->clone; clone_call = zobj->handlers->clone_obj; if (UNEXPECTED(clone_call == NULL)) { - zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Trying to clone an uncloneable object of class %pS", ce->name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -6003,7 +6003,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_YIELD_FROM_SP if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Object of type %pS did not create an Iterator", ce->name); } UNDEF_RESULT(); HANDLE_EXCEPTION(); @@ -6173,8 +6173,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_T if (!zend_check_type(&arginfo->type, value, /* is_return_type */ false, /* is_internal */ true)) { zend_string *expected = zend_type_to_string(arginfo->type); zend_argument_type_error_ex(fbc, argno, - "must be of type %s, %s given", - ZSTR_VAL(expected), zend_zval_value_name(value)); + "must be of type %pS, %s given", + expected, zend_zval_value_name(value)); zend_string_release(expected); } } @@ -7635,7 +7635,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -7733,7 +7733,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_USER_CAL init_func_run_time_cache(&func->op_array); } } else { - zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error); + zend_type_error("%pS(): Argument #1 ($callback) must be a valid callback, %s", Z_STR_P(RT_CONSTANT(opline, opline->op1)), error); efree(error); @@ -7887,7 +7887,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -7895,7 +7895,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -7943,8 +7943,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -9191,14 +9191,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -9242,8 +9242,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -10411,7 +10411,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -10508,7 +10508,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_USER_CAL init_func_run_time_cache(&func->op_array); } } else { - zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error); + zend_type_error("%pS(): Argument #1 ($callback) must be a valid callback, %s", Z_STR_P(RT_CONSTANT(opline, opline->op1)), error); efree(error); zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); HANDLE_EXCEPTION(); @@ -10993,7 +10993,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV_ /* Keep name alive in case an error handler tries to free it. */ zend_string_addref(name); } - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval)); @@ -11016,7 +11016,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV_ } else if (type == BP_VAR_IS || type == BP_VAR_UNSET) { retval = &EG(uninitialized_zval); } else { - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { ZVAL_NULL(retval); @@ -11203,7 +11203,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -12103,12 +12103,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_PARENT_P zend_property_info *prop_info = zend_hash_find_ptr(&parent_ce->properties_info, property_name); if (!prop_info) { - zend_throw_error(NULL, "Undefined property %s::$%s", ZSTR_VAL(parent_ce->name), ZSTR_VAL(property_name)); + zend_throw_error(NULL, "Undefined property %pS::$%pS", parent_ce->name, property_name); UNDEF_RESULT(); HANDLE_EXCEPTION(); } if (prop_info->flags & ZEND_ACC_PRIVATE) { - zend_throw_error(NULL, "Cannot access private property %s::$%s", ZSTR_VAL(parent_ce->name), ZSTR_VAL(property_name)); + zend_throw_error(NULL, "Cannot access private property %pS::$%pS", parent_ce->name, property_name); UNDEF_RESULT(); HANDLE_EXCEPTION(); } @@ -13075,7 +13075,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -13173,7 +13173,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_USER_CAL init_func_run_time_cache(&func->op_array); } } else { - zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error); + zend_type_error("%pS(): Argument #1 ($callback) must be a valid callback, %s", Z_STR_P(RT_CONSTANT(opline, opline->op1)), error); efree(error); @@ -17526,7 +17526,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_CLONE_SPEC_TM clone = ce->clone; clone_call = zobj->handlers->clone_obj; if (UNEXPECTED(clone_call == NULL)) { - zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Trying to clone an uncloneable object of class %pS", ce->name); zval_ptr_dtor_nogc(EX_VAR(opline->op1.var)); ZVAL_UNDEF(EX_VAR(opline->result.var)); HANDLE_EXCEPTION(); @@ -18187,7 +18187,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_YIELD_FROM_SP if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Object of type %pS did not create an Iterator", ce->name); } UNDEF_RESULT(); HANDLE_EXCEPTION(); @@ -21491,7 +21491,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV_ /* Keep name alive in case an error handler tries to free it. */ zend_string_addref(name); } - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval)); @@ -21514,7 +21514,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV_ } else if (type == BP_VAR_IS || type == BP_VAR_UNSET) { retval = &EG(uninitialized_zval); } else { - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { ZVAL_NULL(retval); @@ -23836,8 +23836,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FE_FETCH_RW_S if (prop_info) { if (UNEXPECTED(prop_info->flags & ZEND_ACC_READONLY)) { zend_throw_error(NULL, - "Cannot acquire reference to readonly property %s::$%s", - ZSTR_VAL(prop_info->ce->name), ZSTR_VAL(p->key)); + "Cannot acquire reference to readonly property %pS::$%pS", + prop_info->ce->name, p->key); UNDEF_RESULT(); HANDLE_EXCEPTION(); } @@ -25710,7 +25710,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -26114,7 +26114,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -26122,7 +26122,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -26170,8 +26170,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -26654,14 +26654,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -26705,8 +26705,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -28405,7 +28405,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -29610,7 +29610,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -32284,7 +32284,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -32903,7 +32903,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_CLONE_SPEC_UN clone = ce->clone; clone_call = zobj->handlers->clone_obj; if (UNEXPECTED(clone_call == NULL)) { - zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Trying to clone an uncloneable object of class %pS", ce->name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -34496,7 +34496,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -34679,7 +34679,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -34687,7 +34687,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -34735,8 +34735,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -35060,14 +35060,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -35111,8 +35111,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_FETCH_CLASS_C CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -36602,7 +36602,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -37024,7 +37024,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -39214,7 +39214,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_INIT_STATIC_M HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -40254,7 +40254,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_CLONE_SPEC_CV clone = ce->clone; clone_call = zobj->handlers->clone_obj; if (UNEXPECTED(clone_call == NULL)) { - zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Trying to clone an uncloneable object of class %pS", ce->name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -40833,7 +40833,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_YIELD_FROM_SP if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Object of type %pS did not create an Iterator", ce->name); } UNDEF_RESULT(); HANDLE_EXCEPTION(); @@ -48683,7 +48683,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV_ /* Keep name alive in case an error handler tries to free it. */ zend_string_addref(name); } - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval)); @@ -48706,7 +48706,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV_ } else if (type == BP_VAR_IS || type == BP_VAR_UNSET) { retval = &EG(uninitialized_zval); } else { - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { ZVAL_NULL(retval); @@ -53755,7 +53755,7 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_C SAVE_OPLINE(); function_name = RT_CONSTANT(opline, opline->op2); - zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(function_name)); + zend_throw_error(NULL, "Call to undefined function %pS()", Z_STR_P(function_name)); HANDLE_EXCEPTION(); } @@ -55461,7 +55461,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_SEND_UNPACK_SPEC_T FREE_OP(opline->op1_type, opline->op1.var); if (!EG(exception)) { zend_throw_exception_ex( - NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name) + NULL, 0, "Object of type %pS did not create an Iterator", ce->name ); } HANDLE_EXCEPTION(); @@ -55523,11 +55523,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_SEND_UNPACK_SPEC_T if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) { zend_error( - E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()" + E_WARNING, "Cannot pass by-reference argument %d of %s%s%pS()" " by unpacking a Traversable, passing by-value instead", arg_num, EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - ZSTR_VAL(EX(call)->func->common.function_name) + EX(call)->func->common.function_name ); ZVAL_NEW_REF(top, arg); } else { @@ -55549,11 +55549,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_SEND_UNPACK_SPEC_T if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) { zend_error( - E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()" + E_WARNING, "Cannot pass by-reference argument %d of %s%s%pS()" " by unpacking a Traversable, passing by-value instead", arg_num, EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - ZSTR_VAL(EX(call)->func->common.function_name) + EX(call)->func->common.function_name ); ZVAL_NEW_REF(top, arg); } else { @@ -55821,7 +55821,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_ADD_ARRAY_UNPACK_S FREE_OP(opline->op1_type, opline->op1.var); if (!EG(exception)) { zend_throw_exception_ex( - NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name) + NULL, 0, "Object of type %pS did not create an Iterator", ce->name ); } HANDLE_EXCEPTION(); @@ -58137,7 +58137,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_CLONE clone = ce->clone; clone_call = zobj->handlers->clone_obj; if (UNEXPECTED(clone_call == NULL)) { - zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Trying to clone an uncloneable object of class %pS", ce->name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -58835,7 +58835,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_YIELD_FROM_SPEC_CO if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Object of type %pS did not create an Iterator", ce->name); } UNDEF_RESULT(); HANDLE_EXCEPTION(); @@ -59005,8 +59005,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_TYPE_A if (!zend_check_type(&arginfo->type, value, /* is_return_type */ false, /* is_internal */ true)) { zend_string *expected = zend_type_to_string(arginfo->type); zend_argument_type_error_ex(fbc, argno, - "must be of type %s, %s given", - ZSTR_VAL(expected), zend_zval_value_name(value)); + "must be of type %pS, %s given", + expected, zend_zval_value_name(value)); zend_string_release(expected); } } @@ -60467,7 +60467,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -60565,7 +60565,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_USER_CALL_SPE init_func_run_time_cache(&func->op_array); } } else { - zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error); + zend_type_error("%pS(): Argument #1 ($callback) must be a valid callback, %s", Z_STR_P(RT_CONSTANT(opline, opline->op1)), error); efree(error); @@ -60719,7 +60719,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -60727,7 +60727,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -60775,8 +60775,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -62023,14 +62023,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -62074,8 +62074,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -63243,7 +63243,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -63340,7 +63340,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_USER_CALL_SPE init_func_run_time_cache(&func->op_array); } } else { - zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error); + zend_type_error("%pS(): Argument #1 ($callback) must be a valid callback, %s", Z_STR_P(RT_CONSTANT(opline, opline->op1)), error); efree(error); zval_ptr_dtor_nogc(EX_VAR(opline->op2.var)); HANDLE_EXCEPTION(); @@ -63933,7 +63933,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -64833,12 +64833,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_PARENT_PROPER zend_property_info *prop_info = zend_hash_find_ptr(&parent_ce->properties_info, property_name); if (!prop_info) { - zend_throw_error(NULL, "Undefined property %s::$%s", ZSTR_VAL(parent_ce->name), ZSTR_VAL(property_name)); + zend_throw_error(NULL, "Undefined property %pS::$%pS", parent_ce->name, property_name); UNDEF_RESULT(); HANDLE_EXCEPTION(); } if (prop_info->flags & ZEND_ACC_PRIVATE) { - zend_throw_error(NULL, "Cannot access private property %s::$%s", ZSTR_VAL(parent_ce->name), ZSTR_VAL(property_name)); + zend_throw_error(NULL, "Cannot access private property %pS::$%pS", parent_ce->name, property_name); UNDEF_RESULT(); HANDLE_EXCEPTION(); } @@ -65805,7 +65805,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -65903,7 +65903,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_USER_CALL_SPE init_func_run_time_cache(&func->op_array); } } else { - zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error); + zend_type_error("%pS(): Argument #1 ($callback) must be a valid callback, %s", Z_STR_P(RT_CONSTANT(opline, opline->op1)), error); efree(error); @@ -70256,7 +70256,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_CLONE_SPEC_TMP_TAI clone = ce->clone; clone_call = zobj->handlers->clone_obj; if (UNEXPECTED(clone_call == NULL)) { - zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Trying to clone an uncloneable object of class %pS", ce->name); zval_ptr_dtor_nogc(EX_VAR(opline->op1.var)); ZVAL_UNDEF(EX_VAR(opline->result.var)); HANDLE_EXCEPTION(); @@ -70917,7 +70917,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_YIELD_FROM_SPEC_TM if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Object of type %pS did not create an Iterator", ce->name); } UNDEF_RESULT(); HANDLE_EXCEPTION(); @@ -76466,8 +76466,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FE_FETCH_RW_SPEC_V if (prop_info) { if (UNEXPECTED(prop_info->flags & ZEND_ACC_READONLY)) { zend_throw_error(NULL, - "Cannot acquire reference to readonly property %s::$%s", - ZSTR_VAL(prop_info->ce->name), ZSTR_VAL(p->key)); + "Cannot acquire reference to readonly property %pS::$%pS", + prop_info->ce->name, p->key); UNDEF_RESULT(); HANDLE_EXCEPTION(); } @@ -78340,7 +78340,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -78744,7 +78744,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -78752,7 +78752,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -78800,8 +78800,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -79284,14 +79284,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -79335,8 +79335,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -81035,7 +81035,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -82240,7 +82240,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -84914,7 +84914,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -85533,7 +85533,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_CLONE_SPEC_UNUSED_ clone = ce->clone; clone_call = zobj->handlers->clone_obj; if (UNEXPECTED(clone_call == NULL)) { - zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Trying to clone an uncloneable object of class %pS", ce->name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -87126,7 +87126,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -87309,7 +87309,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -87317,7 +87317,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -87365,8 +87365,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -87690,14 +87690,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA c = Z_PTR_P(zv); scope = EX(func)->op_array.scope; if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access %s constant %pS::%pS", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); } if (ce->ce_flags & ZEND_ACC_TRAIT) { - zend_throw_error(NULL, "Cannot access trait constant %s::%s directly", ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Cannot access trait constant %pS::%pS directly", ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -87741,8 +87741,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_FETCH_CLASS_CONSTA CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value); } } else { - zend_throw_error(NULL, "Undefined constant %s::%s", - ZSTR_VAL(ce->name), ZSTR_VAL(constant_name)); + zend_throw_error(NULL, "Undefined constant %pS::%pS", + ce->name, constant_name); ZVAL_UNDEF(EX_VAR(opline->result.var)); FREE_OP(opline->op2_type, opline->op2.var); HANDLE_EXCEPTION(); @@ -89232,7 +89232,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -89654,7 +89654,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -91844,7 +91844,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_INIT_STATIC_METHOD HANDLE_EXCEPTION(); } if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Cannot call private %pS::__construct()", ce->name); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -92884,7 +92884,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_CLONE_SPEC_CV_TAIL clone = ce->clone; clone_call = zobj->handlers->clone_obj; if (UNEXPECTED(clone_call == NULL)) { - zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Trying to clone an uncloneable object of class %pS", ce->name); ZVAL_UNDEF(EX_VAR(opline->result.var)); @@ -93463,7 +93463,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_YIELD_FROM_SPEC_CV if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); + zend_throw_error(NULL, "Object of type %pS did not create an Iterator", ce->name); } UNDEF_RESULT(); HANDLE_EXCEPTION(); @@ -106697,7 +106697,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV_EX z /* Keep name alive in case an error handler tries to free it. */ zend_string_addref(name); } - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval)); @@ -106720,7 +106720,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV_EX z } else if (type == BP_VAR_IS || type == BP_VAR_UNSET) { retval = &EG(uninitialized_zval); } else { - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { ZVAL_NULL(retval); @@ -106799,7 +106799,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV_EX z /* Keep name alive in case an error handler tries to free it. */ zend_string_addref(name); } - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval)); @@ -106822,7 +106822,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV_EX z } else if (type == BP_VAR_IS || type == BP_VAR_UNSET) { retval = &EG(uninitialized_zval); } else { - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { ZVAL_NULL(retval); @@ -106901,7 +106901,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV_EX z /* Keep name alive in case an error handler tries to free it. */ zend_string_addref(name); } - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval)); @@ -106924,7 +106924,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV_EX z } else if (type == BP_VAR_IS || type == BP_VAR_UNSET) { retval = &EG(uninitialized_zval); } else { - zend_error_unchecked(E_WARNING, "Undefined %svariable $%S", + zend_error(E_WARNING, "Undefined %svariable $%pS", (opline->extended_value & ZEND_FETCH_GLOBAL ? "global " : ""), name); if (type == BP_VAR_RW && !EG(exception)) { ZVAL_NULL(retval); diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c index ad0308f44e20..6e0e32c124df 100644 --- a/Zend/zend_weakrefs.c +++ b/Zend/zend_weakrefs.c @@ -380,7 +380,7 @@ static zval *zend_weakmap_read_dimension(zend_object *object, zval *offset, int if (zv == NULL) { if (type != BP_VAR_IS) { zend_throw_error(NULL, - "Object %s#%d not contained in WeakMap", ZSTR_VAL(obj_addr->ce->name), obj_addr->handle); + "Object %pS#%d not contained in WeakMap", obj_addr->ce->name, obj_addr->handle); return NULL; } return NULL; diff --git a/ext/date/tests/bug65672.phpt b/ext/date/tests/bug65672.phpt index a3a4542e69db..ef93d7345255 100644 --- a/ext/date/tests/bug65672.phpt +++ b/ext/date/tests/bug65672.phpt @@ -41,16 +41,16 @@ array(1) { } bool(false) -Deprecated: Creation of dynamic property DatePeriod@anonymous::$dynamic1 is deprecated in %s on line %d +Deprecated: Creation of dynamic property DatePeriod@anonymous%0%s:4$%x::$dynamic1 is deprecated in %s on line %d string(7) "dynamic" -Deprecated: Creation of dynamic property DatePeriod@anonymous::$dynamic2 is deprecated in %s on line %d +Deprecated: Creation of dynamic property DatePeriod@anonymous%0%s:4$%x::$dynamic2 is deprecated in %s on line %d array(1) { [0]=> string(5) "array" } -Deprecated: Creation of dynamic property DatePeriod@anonymous::$dynamic3 is deprecated in %s on line %d +Deprecated: Creation of dynamic property DatePeriod@anonymous%0%s:4$%x::$dynamic3 is deprecated in %s on line %d array(1) { [0]=> string(5) "array" diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 660a17c05687..5fe56dcc7149 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -109,8 +109,8 @@ static ZEND_COLD void ZEND_FASTCALL zend_jit_invalid_method_call(zval *object) } object = &EG(uninitialized_zval); } - zend_throw_error(NULL, "Call to a member function %s() on %s", - Z_STRVAL_P(function_name), zend_zval_value_name(object)); + zend_throw_error(NULL, "Call to a member function %pS() on %s", + Z_STR_P(function_name), zend_zval_value_name(object)); } static ZEND_COLD void ZEND_FASTCALL zend_jit_invalid_method_call_tmp(zval *object) @@ -584,7 +584,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim, } retval = zend_hash_find(ht, offset_key); if (!retval) { - zend_error(E_WARNING, "Undefined array key \"%s\"", ZSTR_VAL(offset_key)); + zend_error(E_WARNING, "Undefined array key \"%pS\"", offset_key); ZVAL_NULL(result); return; } @@ -1188,7 +1188,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type) /* allow errors */ true, NULL, &trailing_data)) { if (UNEXPECTED(trailing_data) && EG(current_execute_data)->opline->opcode != ZEND_FETCH_DIM_UNSET) { - zend_error(E_WARNING, "Illegal string offset \"%s\"", Z_STRVAL_P(dim)); + zend_error(E_WARNING, "Illegal string offset \"%pS\"", Z_STR_P(dim)); } return offset; } @@ -1538,7 +1538,7 @@ static zend_always_inline void ZEND_FASTCALL zend_jit_fetch_dim_obj_helper(zval zend_class_entry *ce = obj->ce; ZVAL_NULL(result); - zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ZSTR_VAL(ce->name)); + zend_error(E_NOTICE, "Indirect modification of overloaded element of %pS has no effect", ce->name); } else if (EXPECTED(retval && Z_TYPE_P(retval) != IS_UNDEF)) { if (!Z_ISREF_P(retval)) { if (result != retval) { @@ -1547,7 +1547,7 @@ static zend_always_inline void ZEND_FASTCALL zend_jit_fetch_dim_obj_helper(zval } if (Z_TYPE_P(retval) != IS_OBJECT) { zend_class_entry *ce = obj->ce; - zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ZSTR_VAL(ce->name)); + zend_error(E_NOTICE, "Indirect modification of overloaded element of %pS has no effect", ce->name); } } else if (UNEXPECTED(Z_REFCOUNT_P(retval) == 1)) { ZVAL_UNREF(retval); @@ -2232,10 +2232,10 @@ static zend_always_inline bool check_type_array_assignable(zend_type type) { static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_prop_error(zend_property_info *prop, const char *type) { zend_string *type_str = zend_type_to_string(prop->type); zend_type_error( - "Cannot auto-initialize an %s inside property %s::$%s of type %s", + "Cannot auto-initialize an %s inside property %pS::$%s of type %pS", type, - ZSTR_VAL(prop->ce->name), zend_get_unmangled_property_name(prop->name), - ZSTR_VAL(type_str) + prop->ce->name, zend_get_unmangled_property_name(prop->name), + type_str ); zend_string_release(type_str); } @@ -2243,8 +2243,8 @@ static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_prop_error(zend_ static zend_never_inline ZEND_COLD void zend_throw_access_uninit_prop_by_ref_error( zend_property_info *prop) { zend_throw_error(NULL, - "Cannot access uninitialized non-nullable property %s::$%s by reference", - ZSTR_VAL(prop->ce->name), + "Cannot access uninitialized non-nullable property %pS::$%s by reference", + prop->ce->name, zend_get_unmangled_property_name(prop->name)); } @@ -2351,9 +2351,9 @@ static void ZEND_FASTCALL zend_jit_check_array_promotion(zval *val, zend_propert && (ZEND_TYPE_FULL_MASK(prop->type) & MAY_BE_ARRAY) == 0) { zend_string *type_str = zend_type_to_string(prop->type); zend_type_error( - "Cannot auto-initialize an array inside property %s::$%s of type %s", - ZSTR_VAL(prop->ce->name), zend_get_unmangled_property_name(prop->name), - ZSTR_VAL(type_str) + "Cannot auto-initialize an array inside property %pS::$%s of type %pS", + prop->ce->name, zend_get_unmangled_property_name(prop->name), + type_str ); zend_string_release(type_str); ZVAL_ERROR(result); @@ -2490,10 +2490,10 @@ static ZEND_COLD void zend_jit_throw_inc_ref_error(zend_reference *ref, zend_pro zend_string *type_str = zend_type_to_string(error_prop->type); zend_type_error( - "Cannot increment a reference held by property %s::$%s of type %s past its maximal value", - ZSTR_VAL(error_prop->ce->name), + "Cannot increment a reference held by property %pS::$%s of type %pS past its maximal value", + error_prop->ce->name, zend_get_unmangled_property_name(error_prop->name), - ZSTR_VAL(type_str)); + type_str); zend_string_release(type_str); } @@ -2502,10 +2502,10 @@ static ZEND_COLD void zend_jit_throw_dec_ref_error(zend_reference *ref, zend_pro zend_string *type_str = zend_type_to_string(error_prop->type); zend_type_error( - "Cannot decrement a reference held by property %s::$%s of type %s past its minimal value", - ZSTR_VAL(error_prop->ce->name), + "Cannot decrement a reference held by property %pS::$%s of type %pS past its minimal value", + error_prop->ce->name, zend_get_unmangled_property_name(error_prop->name), - ZSTR_VAL(type_str)); + type_str); zend_string_release(type_str); } @@ -2662,14 +2662,14 @@ static void ZEND_FASTCALL zend_jit_invalid_property_read(zval *container, const zend_error(E_WARNING, "Attempt to read property \"%s\" on %s", property_name, zend_zval_value_name(container)); } -static void ZEND_FASTCALL zend_jit_invalid_property_write(zval *container, const char *property_name) +static void ZEND_FASTCALL zend_jit_invalid_property_write(zval *container, zend_string *property_name) { zend_throw_error(NULL, - "Attempt to modify property \"%s\" on %s", + "Attempt to modify property \"%pS\" on %s", property_name, zend_zval_value_name(container)); } -static void ZEND_FASTCALL zend_jit_invalid_property_incdec(zval *container, const char *property_name) +static void ZEND_FASTCALL zend_jit_invalid_property_incdec(zval *container, zend_string *property_name) { zend_execute_data *execute_data = EG(current_execute_data); const zend_op *opline = EX(opline); @@ -2683,21 +2683,21 @@ static void ZEND_FASTCALL zend_jit_invalid_property_incdec(zval *container, cons ZVAL_UNDEF(EX_VAR(opline->result.var)); } zend_throw_error(NULL, - "Attempt to increment/decrement property \"%s\" on %s", + "Attempt to increment/decrement property \"%pS\" on %s", property_name, zend_zval_value_name(container)); if (opline->op1_type == IS_VAR) { zval_ptr_dtor_nogc(EX_VAR(opline->op1.var)); } } -static void ZEND_FASTCALL zend_jit_invalid_property_assign(zval *container, const char *property_name) +static void ZEND_FASTCALL zend_jit_invalid_property_assign(zval *container, zend_string *property_name) { zend_throw_error(NULL, - "Attempt to assign property \"%s\" on %s", + "Attempt to assign property \"%pS\" on %s", property_name, zend_zval_value_name(container)); } -static void ZEND_FASTCALL zend_jit_invalid_property_assign_op(zval *container, const char *property_name) +static void ZEND_FASTCALL zend_jit_invalid_property_assign_op(zval *container, zend_string *property_name) { if (Z_TYPE_P(container) == IS_UNDEF) { const zend_execute_data *execute_data = EG(current_execute_data); @@ -2962,10 +2962,10 @@ static void ZEND_FASTCALL zend_jit_assign_obj_op_helper(zend_object *zobj, zend_ static ZEND_COLD zend_long _zend_jit_throw_inc_prop_error(zend_property_info *prop) { zend_string *type_str = zend_type_to_string(prop->type); - zend_type_error("Cannot increment property %s::$%s of type %s past its maximal value", - ZSTR_VAL(prop->ce->name), + zend_type_error("Cannot increment property %pS::$%s of type %pS past its maximal value", + prop->ce->name, zend_get_unmangled_property_name(prop->name), - ZSTR_VAL(type_str)); + type_str); zend_string_release(type_str); return ZEND_LONG_MAX; } @@ -2973,10 +2973,10 @@ static ZEND_COLD zend_long _zend_jit_throw_inc_prop_error(zend_property_info *pr static ZEND_COLD zend_long _zend_jit_throw_dec_prop_error(zend_property_info *prop) { zend_string *type_str = zend_type_to_string(prop->type); - zend_type_error("Cannot decrement property %s::$%s of type %s past its minimal value", - ZSTR_VAL(prop->ce->name), + zend_type_error("Cannot decrement property %pS::$%s of type %pS past its minimal value", + prop->ce->name, zend_get_unmangled_property_name(prop->name), - ZSTR_VAL(type_str)); + type_str); zend_string_release(type_str); return ZEND_LONG_MIN; } @@ -3408,8 +3408,8 @@ static void ZEND_FASTCALL zend_jit_uninit_static_prop(void) uint32_t cache_slot = opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS; const zend_property_info *property_info = CACHED_PTR(cache_slot + sizeof(void *) * 2); - zend_throw_error(NULL, "Typed static property %s::$%s must not be accessed before initialization", - ZSTR_VAL(property_info->ce->name), + zend_throw_error(NULL, "Typed static property %pS::$%s must not be accessed before initialization", + property_info->ce->name, zend_get_unmangled_property_name(property_info->name)); } diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c index 2bbd7b0e3f4d..d82e1a90bbeb 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -14349,7 +14349,7 @@ static int zend_jit_fetch_obj(zend_jit_ctx *jit, } if (opline->opcode == ZEND_FETCH_OBJ_W) { ir_CALL_2(IR_VOID, ir_CONST_FC_FUNC(zend_jit_invalid_property_write), - op1_ref, ir_CONST_ADDR(Z_STRVAL_P(member))); + op1_ref, ir_CONST_ADDR(Z_STR_P(member))); jit_set_Z_TYPE_INFO(jit, res_addr, _IS_ERROR); } else { ir_CALL_2(IR_VOID, ir_CONST_FC_FUNC(zend_jit_invalid_property_read), @@ -14928,7 +14928,7 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit, jit_SET_EX_OPLINE(jit, opline); ir_CALL_2(IR_VOID, ir_CONST_FC_FUNC(zend_jit_invalid_property_assign), jit_ZVAL_ADDR(jit, op1_addr), - ir_CONST_ADDR(ZSTR_VAL(name))); + ir_CONST_ADDR(name)); if (RETURN_VALUE_USED(opline) && Z_MODE(res_addr) != IS_REG) { jit_set_Z_TYPE_INFO(jit, res_addr, IS_NULL); @@ -15277,7 +15277,7 @@ static int zend_jit_assign_obj_op(zend_jit_ctx *jit, ir_CONST_FC_FUNC(zend_jit_invalid_property_assign_op) : ir_CONST_FC_FUNC(zend_jit_invalid_property_assign), jit_ZVAL_ADDR(jit, op1_addr), - ir_CONST_ADDR(ZSTR_VAL(name))); + ir_CONST_ADDR(name)); may_throw = true; @@ -15709,7 +15709,7 @@ static int zend_jit_incdec_obj(zend_jit_ctx *jit, jit_SET_EX_OPLINE(jit, opline); ir_CALL_2(IR_VOID, ir_CONST_FC_FUNC(zend_jit_invalid_property_incdec), jit_ZVAL_ADDR(jit, op1_addr), - ir_CONST_ADDR(ZSTR_VAL(name))); + ir_CONST_ADDR(name)); ir_IJMP(jit_STUB_ADDR(jit, jit_stub_exception_handler)); ir_IF_TRUE(if_obj); diff --git a/ext/standard/tests/class_object/bug78638.phpt b/ext/standard/tests/class_object/bug78638.phpt index aaadcda836e7..c6565d035634 100644 --- a/ext/standard/tests/class_object/bug78638.phpt +++ b/ext/standard/tests/class_object/bug78638.phpt @@ -6,4 +6,4 @@ $c = new class('bar') extends __PHP_Incomplete_Class { }; ?> --EXPECTF-- -Fatal error: Class __PHP_Incomplete_Class@anonymous cannot extend final class __PHP_Incomplete_Class in %s on line %d +Fatal error: Class __PHP_Incomplete_Class@anonymous%0%s:2$%x cannot extend final class __PHP_Incomplete_Class in %s on line %d diff --git a/ext/standard/tests/serialize/unserialize_callback_func/fn_with_null_bytes.phpt b/ext/standard/tests/serialize/unserialize_callback_func/fn_with_null_bytes.phpt index 5341d4bb6dd8..d3b9b6fbb430 100644 --- a/ext/standard/tests/serialize/unserialize_callback_func/fn_with_null_bytes.phpt +++ b/ext/standard/tests/serialize/unserialize_callback_func/fn_with_null_bytes.phpt @@ -20,6 +20,6 @@ try { echo "Done"; ?> ---EXPECT-- -Error: Invalid callback foo, function "foo" not found or invalid function name +--EXPECTF-- +Error: Invalid callback foo%0butno, function "foo" not found or invalid function name Done