Commit fc25b646e63 for php
commit fc25b646e636686319125fd34ba307ced4e5a1f6
Author: Alexander Danilov <10532067+adapik@users.noreply.github.com>
Date: Thu Nov 12 02:49:33 2026 +0200
ext/standard/mail, zend_test: use %pS to format zend_string (#25384)
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index db22ef22b2f..b155e089459 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -471,7 +471,7 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
time(&curtime);
date_str = php_format_date("d-M-Y H:i:s e", 13, curtime, 1);
- len = spprintf(&tmp, 0, "[%s] %s%s", ZSTR_VAL(date_str), logline, PHP_EOL);
+ len = spprintf(&tmp, 0, "[%pS] %s%s", date_str, logline, PHP_EOL);
php_mail_log_to_file(mail_log, tmp, len);
@@ -515,9 +515,9 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
f = php_basename(tmp, strlen(tmp), NULL, 0);
if (headers != NULL && *headers) {
- spprintf(&ahdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s%s%s", php_getuid(), ZSTR_VAL(f), line_sep, headers);
+ spprintf(&ahdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%pS%s%s", php_getuid(), f, line_sep, headers);
} else {
- spprintf(&ahdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s", php_getuid(), ZSTR_VAL(f));
+ spprintf(&ahdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%pS", php_getuid(), f);
}
hdr = ahdr;
zend_string_release_ex(f, 0);
@@ -549,7 +549,7 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
#endif
}
if (extra_cmd != NULL) {
- spprintf(&sendmail_cmd, 0, "%s %s", sendmail_path, ZSTR_VAL(extra_cmd));
+ spprintf(&sendmail_cmd, 0, "%s %pS", sendmail_path, extra_cmd);
} else {
sendmail_cmd = (char*)sendmail_path;
}
diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c
index 5c33722c5ca..fc346dd5aa0 100644
--- a/ext/zend_test/test.c
+++ b/ext/zend_test/test.c
@@ -1111,7 +1111,7 @@ static ZEND_FUNCTION(zend_call_method)
} else if (Z_TYPE_P(class_or_object) == IS_STRING) {
ce = zend_lookup_class(Z_STR_P(class_or_object));
if (!ce) {
- zend_error_noreturn(E_ERROR, "Unknown class '%s'", Z_STRVAL_P(class_or_object));
+ zend_error_noreturn(E_ERROR, "Unknown class '%pS'", Z_STR_P(class_or_object));
}
} else {
zend_argument_type_error(1, "must be of type object|string, %s given", zend_zval_value_name(class_or_object));
@@ -1280,7 +1280,7 @@ static ZEND_FUNCTION(zend_test_zend_ini_parse_quantity)
RETVAL_LONG(zend_ini_parse_quantity(str, &errstr));
if (errstr) {
- zend_error(E_WARNING, "%s", ZSTR_VAL(errstr));
+ zend_error(E_WARNING, "%pS", errstr);
zend_string_release(errstr);
}
}
@@ -1297,7 +1297,7 @@ static ZEND_FUNCTION(zend_test_zend_ini_parse_uquantity)
RETVAL_LONG((zend_long)zend_ini_parse_uquantity(str, &errstr));
if (errstr) {
- zend_error(E_WARNING, "%s", ZSTR_VAL(errstr));
+ zend_error(E_WARNING, "%pS", errstr);
zend_string_release(errstr);
}
}
@@ -1440,7 +1440,7 @@ static ZEND_FUNCTION(zend_test_crash)
ZEND_PARSE_PARAMETERS_END();
if (message) {
- php_printf("%s", ZSTR_VAL(message));
+ php_printf("%pS", message);
}
char *invalid = (char *) 1;
@@ -2321,7 +2321,7 @@ static ZEND_METHOD(_ZendTestClass, takesUnionType)
);
if (!type_matches) {
zend_string *ty = zend_type_to_string(execute_data->func->internal_function.arg_info->type);
- zend_argument_type_error(1, "must be of type %s, %s given", ZSTR_VAL(ty), ZSTR_VAL(obj->ce->name));
+ zend_argument_type_error(1, "must be of type %pS, %pS given", ty, obj->ce->name);
zend_string_release(ty);
RETURN_THROWS();
}
@@ -2382,7 +2382,7 @@ static ZEND_NAMED_FUNCTION(zend_test_internal_dnf_arguments)
);
if (!type_matches) {
zend_string *ty = zend_type_to_string(arginfo_zend_test_internal_dnf_arguments[1].type);
- zend_argument_type_error(1, "must be of type %s, %s given", ZSTR_VAL(ty), ZSTR_VAL(obj->ce->name));
+ zend_argument_type_error(1, "must be of type %pS, %pS given", ty, obj->ce->name);
zend_string_release(ty);
RETURN_THROWS();
}