Skip to content

Commit fc25b64

Browse files
authored
ext/standard/mail, zend_test: use %pS to format zend_string (#25384)
1 parent 8eb02db commit fc25b64

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎ext/standard/mail.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
471471

472472
time(&curtime);
473473
date_str = php_format_date("d-M-Y H:i:s e", 13, curtime, 1);
474-
len = spprintf(&tmp, 0, "[%s] %s%s", ZSTR_VAL(date_str), logline, PHP_EOL);
474+
len = spprintf(&tmp, 0, "[%pS] %s%s", date_str, logline, PHP_EOL);
475475

476476
php_mail_log_to_file(mail_log, tmp, len);
477477

@@ -515,9 +515,9 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
515515
f = php_basename(tmp, strlen(tmp), NULL, 0);
516516

517517
if (headers != NULL && *headers) {
518-
spprintf(&ahdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s%s%s", php_getuid(), ZSTR_VAL(f), line_sep, headers);
518+
spprintf(&ahdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%pS%s%s", php_getuid(), f, line_sep, headers);
519519
} else {
520-
spprintf(&ahdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s", php_getuid(), ZSTR_VAL(f));
520+
spprintf(&ahdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%pS", php_getuid(), f);
521521
}
522522
hdr = ahdr;
523523
zend_string_release_ex(f, 0);
@@ -549,7 +549,7 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c
549549
#endif
550550
}
551551
if (extra_cmd != NULL) {
552-
spprintf(&sendmail_cmd, 0, "%s %s", sendmail_path, ZSTR_VAL(extra_cmd));
552+
spprintf(&sendmail_cmd, 0, "%s %pS", sendmail_path, extra_cmd);
553553
} else {
554554
sendmail_cmd = (char*)sendmail_path;
555555
}

‎ext/zend_test/test.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ static ZEND_FUNCTION(zend_call_method)
11111111
} else if (Z_TYPE_P(class_or_object) == IS_STRING) {
11121112
ce = zend_lookup_class(Z_STR_P(class_or_object));
11131113
if (!ce) {
1114-
zend_error_noreturn(E_ERROR, "Unknown class '%s'", Z_STRVAL_P(class_or_object));
1114+
zend_error_noreturn(E_ERROR, "Unknown class '%pS'", Z_STR_P(class_or_object));
11151115
}
11161116
} else {
11171117
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)
12801280
RETVAL_LONG(zend_ini_parse_quantity(str, &errstr));
12811281

12821282
if (errstr) {
1283-
zend_error(E_WARNING, "%s", ZSTR_VAL(errstr));
1283+
zend_error(E_WARNING, "%pS", errstr);
12841284
zend_string_release(errstr);
12851285
}
12861286
}
@@ -1297,7 +1297,7 @@ static ZEND_FUNCTION(zend_test_zend_ini_parse_uquantity)
12971297
RETVAL_LONG((zend_long)zend_ini_parse_uquantity(str, &errstr));
12981298

12991299
if (errstr) {
1300-
zend_error(E_WARNING, "%s", ZSTR_VAL(errstr));
1300+
zend_error(E_WARNING, "%pS", errstr);
13011301
zend_string_release(errstr);
13021302
}
13031303
}
@@ -1440,7 +1440,7 @@ static ZEND_FUNCTION(zend_test_crash)
14401440
ZEND_PARSE_PARAMETERS_END();
14411441

14421442
if (message) {
1443-
php_printf("%s", ZSTR_VAL(message));
1443+
php_printf("%pS", message);
14441444
}
14451445

14461446
char *invalid = (char *) 1;
@@ -2321,7 +2321,7 @@ static ZEND_METHOD(_ZendTestClass, takesUnionType)
23212321
);
23222322
if (!type_matches) {
23232323
zend_string *ty = zend_type_to_string(execute_data->func->internal_function.arg_info->type);
2324-
zend_argument_type_error(1, "must be of type %s, %s given", ZSTR_VAL(ty), ZSTR_VAL(obj->ce->name));
2324+
zend_argument_type_error(1, "must be of type %pS, %pS given", ty, obj->ce->name);
23252325
zend_string_release(ty);
23262326
RETURN_THROWS();
23272327
}
@@ -2382,7 +2382,7 @@ static ZEND_NAMED_FUNCTION(zend_test_internal_dnf_arguments)
23822382
);
23832383
if (!type_matches) {
23842384
zend_string *ty = zend_type_to_string(arginfo_zend_test_internal_dnf_arguments[1].type);
2385-
zend_argument_type_error(1, "must be of type %s, %s given", ZSTR_VAL(ty), ZSTR_VAL(obj->ce->name));
2385+
zend_argument_type_error(1, "must be of type %pS, %pS given", ty, obj->ce->name);
23862386
zend_string_release(ty);
23872387
RETURN_THROWS();
23882388
}

0 commit comments

Comments
 (0)