Commit a95e8e26bbb for php
commit a95e8e26bbbfdf248f4a6114bbe204a6ba953a5a
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date: Sat Aug 8 09:41:18 2026 -0700
[`%pS` migration] Use `%pS` in Zend/zend_vm_def.h
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 3ea6d7250ab..4375b7ad3f3 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);
@@ -3853,7 +3853,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;
@@ -4031,7 +4031,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();
@@ -5398,7 +5398,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();
@@ -5460,11 +5460,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 {
@@ -5486,11 +5486,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 {
@@ -6111,7 +6111,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();
@@ -6218,14 +6218,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();
@@ -6269,8 +6269,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();
@@ -6457,7 +6457,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();
@@ -7417,8 +7417,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();
}
@@ -8662,7 +8662,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();
@@ -8967,8 +8967,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);
}
}
@@ -10100,12 +10100,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 fe5c7bfe6ba..59891e70d9a 100644
Binary files a/Zend/zend_vm_execute.h and b/Zend/zend_vm_execute.h differ