From 404a29265638f81e3e7058b6e8a470019e05081c Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Sat, 8 Aug 2026 17:06:13 -0700 Subject: [PATCH] [`%pS` migration] Use `%pS` in ext/openssl --- ext/openssl/openssl.c | 2 +- ext/openssl/openssl_backend_common.c | 12 ++++++------ ext/openssl/openssl_backend_v1.c | 2 +- ext/openssl/openssl_backend_v3.c | 2 +- ext/openssl/xp_ssl.c | 12 ++++++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 80c0a8bab073..9bb502f3e8a9 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -741,7 +741,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 8adf1ac813f1..0901c45574c9 100644 --- a/ext/openssl/openssl_backend_common.c +++ b/ext/openssl/openssl_backend_common.c @@ -383,7 +383,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; } } @@ -937,10 +937,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; } @@ -1005,7 +1005,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(); @@ -1086,13 +1086,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 bfd01b673464..fc5fae4be802 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 375c0104fac5..2b8cc27ad7d5 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 269de9545388..cdf3bd0d946f 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -1493,8 +1493,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; @@ -1518,8 +1518,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; @@ -1532,8 +1532,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 {