[php-src] PHP-8.6: [`%pS` migration] Use `%pS` in Zend/zend_execute.c

From: Date: Fri, 30 Oct 2026 01:10:54 +0000
Subject: [php-src] PHP-8.6: [`%pS` migration] Use `%pS` in Zend/zend_execute.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142984@lists.php.net to get a copy of this message
Author: Daniel Scherzer (DanielEScherzer) Date: 2026-10-29T17:58:20-07:00 Commit: https://github.com/php/php-src/commit/fc06d3954499b092f0c665704bd24d69a07dcefc Raw diff: https://github.com/php/php-src/commit/fc06d3954499b092f0c665704bd24d69a07dcefc.diff [%pS migration] Use %pS in Zend/zend_execute.c In addition to the fixes within the zend_execute.c file, support for error strings with null bytes was added to zend_type_error(). Also update the ext/opcache helpers to match Changed paths: M Zend/tests/gh19304.phpt M Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt M Zend/tests/type_declarations/typed_properties_003.phpt M Zend/tests/type_declarations/typed_properties_004.phpt M Zend/tests/type_declarations/typed_properties_005.phpt M Zend/tests/type_declarations/typed_properties_033.phpt M Zend/tests/type_declarations/typed_properties_034.phpt M Zend/tests/type_declarations/typed_properties_038.phpt M Zend/tests/type_declarations/typed_properties_044.phpt M Zend/tests/type_declarations/typed_properties_062.phpt M Zend/tests/type_declarations/typed_properties_063.phpt M Zend/tests/type_declarations/typed_properties_064.phpt M Zend/tests/type_declarations/typed_properties_065.phpt M Zend/tests/type_declarations/typed_properties_078.phpt M Zend/zend.c M Zend/zend_execute.c M ext/opcache/jit/zend_jit_helpers.c M ext/opcache/jit/zend_jit_ir.c Diff: diff --git a/Zend/tests/gh19304.phpt b/Zend/tests/gh19304.phpt index f3f7fab3f1fe..2d658948a4e0 100644 --- a/Zend/tests/gh19304.phpt +++ b/Zend/tests/gh19304.phpt @@ -14,5 +14,5 @@ try { } ?> ---EXPECT-- -TypeError: Cannot assign int to property class@anonymous::$v of type self +--EXPECTF-- +TypeError: Cannot assign int to property class@anonymous%0%s::$v of type self diff --git a/Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt b/Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt index 6e6dc58baad0..5d68d632a31a 100644 --- a/Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt +++ b/Zend/tests/temporary_cleaning/temporary_cleaning_013.phpt @@ -301,10 +301,10 @@ caught Exception 13 Deprecated: Creation of dynamic property class@anonymous::$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 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 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_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..e92ec7256ca8 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::$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 76d57e4ec48f..59d5943f1fe5 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-- -TypeError: Cannot assign float to reference held by property class@anonymous::$qux of type int +TypeError: Cannot assign float to reference held by property class@anonymous%0%s::$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 dcda621774a7..1ba07f59bb54 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) -TypeError: Cannot assign null to property class@anonymous::$baz of type int +TypeError: Cannot assign null to property class@anonymous%0%s::$baz of type int int(1) int(10) int(10) -TypeError: Cannot assign null to reference held by property class@anonymous::$baz of type int +TypeError: Cannot assign null to reference held by property class@anonymous%0%s::$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 e9843aea3594..0f7ac9b239c7 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-- -TypeError: Cannot increment property class@anonymous::$bar of type int past its maximal value +TypeError: Cannot increment property class@anonymous%0%s::$bar of type int past its maximal value object(class@anonymous)#1 (1) { ["bar"]=> int(%d) } -TypeError: Cannot assign float to property class@anonymous::$bar of type int +TypeError: Cannot assign float to property class@anonymous%0%s::$bar of type int object(class@anonymous)#1 (1) { ["bar"]=> int(%d) } -TypeError: Cannot increment property class@anonymous::$bar of type int past its maximal value +TypeError: Cannot increment property class@anonymous%0%s::$bar of type int past its maximal value object(class@anonymous)#1 (1) { ["bar"]=> int(%d) } -TypeError: Cannot assign float to property class@anonymous::$bar of type int +TypeError: Cannot assign float to property class@anonymous%0%s::$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 9933c15203a4..f6a5b0cb3614 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) -TypeError: Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value -TypeError: Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value -TypeError: Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value -TypeError: Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value +TypeError: Cannot increment a reference held by property class@anonymous%0%s::$bar of type ?int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous%0%s::$bar of type ?int past its maximal value +TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$bar of type ?int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$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 ba12c77a1845..10cfbc538384 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) -TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign string to reference held by property class@anonymous%0%s::$foo of type int int(21) int(20) int(19) -TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value integer -TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value integer -TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value integer -TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value integer -TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign array to reference held by property class@anonymous%0%s::$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 6a299a11afdf..046f797289bf 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) -TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign string to reference held by property class@anonymous%0%s::$foo of type int int(21) int(20) int(19) -TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value integer -TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value integer -TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value integer -TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value integer -TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign array to reference held by property class@anonymous%0%s::$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 4880707f8f68..e725440812f8 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) -TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign string to reference held by property class@anonymous%0%s::$foo of type int int(21) int(20) int(19) -TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value integer -TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property class@anonymous%0%s::$foo of type int past its minimal value integer -TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value integer -TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property class@anonymous%0%s::$foo of type int past its maximal value integer -TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int +TypeError: Cannot assign array to reference held by property class@anonymous%0%s::$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 a4d0aa4c0c0c..c3e7abda3344 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) -TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous%0%s::$foo of type int past its minimal value integer -TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value +TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous%0%s::$foo of type int past its minimal value integer -TypeError: Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property ArrayAccess@anonymous%0%s::$foo of type int past its maximal value integer -TypeError: Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value +TypeError: Cannot increment a reference held by property ArrayAccess@anonymous%0%s::$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 346516b4b227..1de60d852d49 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) { } -TypeError: Cannot assign array to property class@anonymous::$t of type ?Traversable +TypeError: Cannot assign array to property class@anonymous%0%s::$t of type ?Traversable array(0) { } array(1) { [0]=> int(1) } -TypeError: Cannot assign ArrayIterator to reference held by property class@anonymous::$a of type ?array +TypeError: Cannot assign ArrayIterator to reference held by property class@anonymous%0%s::$a of type ?array bool(false) -TypeError: Cannot assign array to reference held by property class@anonymous::$t of type ?Traversable +TypeError: Cannot assign array to reference held by property class@anonymous%0%s::$t of type ?Traversable bool(false) bool(true) diff --git a/Zend/zend.c b/Zend/zend.c index 55ad84f189fe..e44fa3c1a773 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1876,12 +1876,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_execute.c b/Zend/zend_execute.c index bac0095d1c43..3133caea2e08 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -296,7 +296,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); } @@ -629,8 +629,8 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_cannot_pass_by_reference_ex(const zen zend_string *func_name = get_function_or_method_name(func); const char *param_name = get_function_arg_name(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); @@ -645,9 +645,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); } @@ -655,9 +655,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); } @@ -665,8 +665,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)); } @@ -681,21 +681,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); @@ -742,13 +742,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); @@ -867,8 +867,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); } @@ -883,11 +883,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); } @@ -899,12 +899,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); } @@ -923,7 +923,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); } @@ -941,8 +941,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) @@ -952,8 +952,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( @@ -978,11 +978,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) : ""); } @@ -1378,17 +1378,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) { @@ -1400,20 +1400,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. */ @@ -1431,20 +1431,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); @@ -1461,8 +1461,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); } @@ -1471,8 +1471,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); } @@ -1488,8 +1488,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) @@ -1566,7 +1566,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) @@ -1758,7 +1758,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; } @@ -1878,9 +1878,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 ? ", " : "", @@ -1907,14 +1907,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 ); } @@ -1961,9 +1961,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 ); @@ -1988,14 +1988,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 ); } @@ -2014,10 +2014,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 ); @@ -2034,8 +2034,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 ); @@ -2054,9 +2054,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 ); @@ -2223,18 +2223,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; } @@ -2243,17 +2243,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; } @@ -2533,7 +2533,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) @@ -2584,31 +2584,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 : "", @@ -3001,7 +3001,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) { @@ -3010,7 +3010,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); @@ -3116,7 +3116,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; } @@ -3862,8 +3862,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; } @@ -3931,14 +3931,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); @@ -3946,11 +3946,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); } @@ -3958,14 +3958,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); @@ -5205,7 +5205,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s } else { fbc = zend_fetch_function(function); if (UNEXPECTED(fbc == NULL)) { - zend_throw_error(NULL, "Call to undefined function %s()", ZSTR_VAL(function)); + zend_throw_error(NULL, "Call to undefined function %pS()", function); return NULL; } called_scope = NULL; @@ -5247,7 +5247,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; } @@ -5443,7 +5443,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; @@ -5495,7 +5495,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; @@ -5578,7 +5578,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; } @@ -5592,8 +5592,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; @@ -5624,8 +5624,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/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 146bdc0a5f03..8bbc96159d4d 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -14424,7 +14424,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), @@ -15003,7 +15003,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); @@ -15352,7 +15352,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; @@ -15784,7 +15784,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);

« previous php.cvs (#142984) next »