From 699f09d1f1f8c388e73b612787c1b9a9aa12cc34 Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Wed, 19 Aug 2026 10:23:44 +0530 Subject: [PATCH 1/2] Zend: Use %pS for zend_string in zend_throw_error --- Zend/zend.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index 8643c248e6be..1718972e592f 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1830,11 +1830,7 @@ 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)); } From 5e55e453b311d152b6bed218527add92dbf443e9 Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Wed, 19 Aug 2026 10:30:59 +0530 Subject: [PATCH 2/2] Zend: Use %pS for zend_string in zend_throw_error --- Zend/zend_partial.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Zend/zend_partial.c b/Zend/zend_partial.c index ce1604ddc67a..643cc634e7e8 100644 --- a/Zend/zend_partial.c +++ b/Zend/zend_partial.c @@ -701,8 +701,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; }