Commit e2696bb3225 for php
commit e2696bb32258d1aec50bb471616060a8e644c846
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date: Tue Nov 17 15:25:57 2026 -0800
[`%pS` migration] Use `%pS` in ext/openssl (#23160)
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index d242df0bbba..721f2a3a203 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -739,7 +739,7 @@ static PHP_INI_MH(OnUpdateLibCtx)
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
int err_type = stage == ZEND_INI_STAGE_RUNTIME ? E_WARNING : E_ERROR;
- php_error_docref(NULL, err_type, "OpenSSL libctx \"%s\" cannot be found", ZSTR_VAL(new_value));
+ php_error_docref(NULL, err_type, "OpenSSL libctx \"%pS\" cannot be found", new_value);
}
return FAILURE;
}
diff --git a/ext/openssl/openssl_backend_common.c b/ext/openssl/openssl_backend_common.c
index 995d836deea..454d18ddf8d 100644
--- a/ext/openssl/openssl_backend_common.c
+++ b/ext/openssl/openssl_backend_common.c
@@ -384,7 +384,7 @@ int php_openssl_parse_config(struct php_x509_request * req, zval * optional_args
&& Z_TYPE_P(item) == IS_STRING) {
req->curve_name = OBJ_sn2nid(Z_STRVAL_P(item));
if (req->curve_name == NID_undef) {
- php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %s", Z_STRVAL_P(item));
+ php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %pS", Z_STR_P(item));
return FAILURE;
}
}
@@ -938,10 +938,10 @@ zend_result php_openssl_csr_add_subj_entry(zval *item, X509_NAME *subj, int nid)
{
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING,
- "dn: add_entry_by_NID %d -> %s (failed; check error"
+ "dn: add_entry_by_NID %d -> %pS (failed; check error"
" queue and value of string_mask OpenSSL option "
"if illegal characters are reported)",
- nid, ZSTR_VAL(str_item));
+ nid, str_item);
zend_string_release(str_item);
return FAILURE;
}
@@ -1006,7 +1006,7 @@ zend_result php_openssl_csr_make(struct php_x509_request * req, X509_REQ * csr,
return FAILURE;
}
} else {
- php_error_docref(NULL, E_WARNING, "dn: %s is not a recognized name", ZSTR_VAL(strindex));
+ php_error_docref(NULL, E_WARNING, "dn: %pS is not a recognized name", strindex);
}
}
} ZEND_HASH_FOREACH_END();
@@ -1087,13 +1087,13 @@ zend_result php_openssl_csr_make(struct php_x509_request * req, X509_REQ * csr,
}
if (!X509_REQ_add1_attr_by_NID(csr, nid, MBSTRING_UTF8, (unsigned char*)ZSTR_VAL(str_item), (int)ZSTR_LEN(str_item))) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "attributes: add_attr_by_NID %d -> %s (failed)", nid, ZSTR_VAL(str_item));
+ php_error_docref(NULL, E_WARNING, "attributes: add_attr_by_NID %d -> %pS (failed)", nid, str_item);
zend_string_release(str_item);
return FAILURE;
}
zend_string_release(str_item);
} else {
- php_error_docref(NULL, E_WARNING, "attributes: %s is not a recognized attribute name", ZSTR_VAL(strindex));
+ php_error_docref(NULL, E_WARNING, "attributes: %pS is not a recognized attribute name", strindex);
}
} ZEND_HASH_FOREACH_END();
for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++) {
diff --git a/ext/openssl/openssl_backend_v1.c b/ext/openssl/openssl_backend_v1.c
index bfd01b67346..fc5fae4be80 100644
--- a/ext/openssl/openssl_backend_v1.c
+++ b/ext/openssl/openssl_backend_v1.c
@@ -285,7 +285,7 @@ static bool php_openssl_pkey_init_ec_data(EC_KEY *eckey, zval *data, bool *is_pr
if (curve_name_zv && Z_TYPE_P(curve_name_zv) == IS_STRING && Z_STRLEN_P(curve_name_zv) > 0) {
int nid = OBJ_sn2nid(Z_STRVAL_P(curve_name_zv));
if (nid == NID_undef) {
- php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %s", Z_STRVAL_P(curve_name_zv));
+ php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %pS", Z_STR_P(curve_name_zv));
goto clean_exit;
}
diff --git a/ext/openssl/openssl_backend_v3.c b/ext/openssl/openssl_backend_v3.c
index 375c0104fac..2b8cc27ad7d 100644
--- a/ext/openssl/openssl_backend_v3.c
+++ b/ext/openssl/openssl_backend_v3.c
@@ -320,7 +320,7 @@ EVP_PKEY *php_openssl_pkey_init_ec(zval *data, bool *is_private) {
if (curve_name_zv && Z_TYPE_P(curve_name_zv) == IS_STRING && Z_STRLEN_P(curve_name_zv) > 0) {
nid = OBJ_sn2nid(Z_STRVAL_P(curve_name_zv));
if (nid == NID_undef) {
- php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %s", Z_STRVAL_P(curve_name_zv));
+ php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %pS", Z_STR_P(curve_name_zv));
goto cleanup;
}
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 3e074afdfa1..03ac2304c6e 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -1515,8 +1515,8 @@ static zend_result php_openssl_enable_server_sni(
local_cert_str, resolved_cert_path_buff, 0, false, false,
"SNI_server_certs local_cert in ssl stream context", stream)) {
php_stream_warn(stream, OpenFailed,
- "Failed setting local cert chain file `%s'; could not open file",
- ZSTR_VAL(local_cert_str)
+ "Failed setting local cert chain file `%pS'; could not open file",
+ local_cert_str
);
zend_string_release(local_cert_str);
return FAILURE;
@@ -1540,8 +1540,8 @@ static zend_result php_openssl_enable_server_sni(
local_pk_str, resolved_pk_path_buff, 0, false, false,
"SNI_server_certs local_pk in ssl stream context", stream)) {
php_stream_warn(stream, OpenFailed,
- "Failed setting local private key file `%s'; could not open file",
- ZSTR_VAL(local_pk_str)
+ "Failed setting local private key file `%pS'; could not open file",
+ local_pk_str
);
zend_string_release(local_pk_str);
return FAILURE;
@@ -1554,8 +1554,8 @@ static zend_result php_openssl_enable_server_sni(
ctx = php_openssl_create_sni_server_ctx(stream, resolved_path_buff, resolved_path_buff);
} else {
php_stream_warn(stream, NotFound,
- "Failed setting local cert chain file `%s'; file not found",
- Z_STRVAL_P(current)
+ "Failed setting local cert chain file `%pS'; file not found",
+ Z_STR_P(current)
);
}
} else {