Skip to content

Commit ce04572

Browse files
[%pS migration] Use %pS in ext/openssl
1 parent 89b22fa commit ce04572

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎ext/openssl/openssl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ static PHP_INI_MH(OnUpdateLibCtx)
739739
/* Do not output error when restoring ini options. */
740740
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
741741
int err_type = stage == ZEND_INI_STAGE_RUNTIME ? E_WARNING : E_ERROR;
742-
php_error_docref(NULL, err_type, "OpenSSL libctx \"%s\" cannot be found", ZSTR_VAL(new_value));
742+
php_error_docref(NULL, err_type, "OpenSSL libctx \"%pS\" cannot be found", new_value);
743743
}
744744
return FAILURE;
745745
}

‎ext/openssl/openssl_backend_common.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ int php_openssl_parse_config(struct php_x509_request * req, zval * optional_args
382382
&& Z_TYPE_P(item) == IS_STRING) {
383383
req->curve_name = OBJ_sn2nid(Z_STRVAL_P(item));
384384
if (req->curve_name == NID_undef) {
385-
php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %s", Z_STRVAL_P(item));
385+
php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %pS", Z_STR_P(item));
386386
return FAILURE;
387387
}
388388
}
@@ -936,10 +936,10 @@ zend_result php_openssl_csr_add_subj_entry(zval *item, X509_NAME *subj, int nid)
936936
{
937937
php_openssl_store_errors();
938938
php_error_docref(NULL, E_WARNING,
939-
"dn: add_entry_by_NID %d -> %s (failed; check error"
939+
"dn: add_entry_by_NID %d -> %pS (failed; check error"
940940
" queue and value of string_mask OpenSSL option "
941941
"if illegal characters are reported)",
942-
nid, ZSTR_VAL(str_item));
942+
nid, str_item);
943943
zend_string_release(str_item);
944944
return FAILURE;
945945
}
@@ -1004,7 +1004,7 @@ zend_result php_openssl_csr_make(struct php_x509_request * req, X509_REQ * csr,
10041004
return FAILURE;
10051005
}
10061006
} else {
1007-
php_error_docref(NULL, E_WARNING, "dn: %s is not a recognized name", ZSTR_VAL(strindex));
1007+
php_error_docref(NULL, E_WARNING, "dn: %pS is not a recognized name", strindex);
10081008
}
10091009
}
10101010
} ZEND_HASH_FOREACH_END();
@@ -1085,13 +1085,13 @@ zend_result php_openssl_csr_make(struct php_x509_request * req, X509_REQ * csr,
10851085
}
10861086
if (!X509_REQ_add1_attr_by_NID(csr, nid, MBSTRING_UTF8, (unsigned char*)ZSTR_VAL(str_item), (int)ZSTR_LEN(str_item))) {
10871087
php_openssl_store_errors();
1088-
php_error_docref(NULL, E_WARNING, "attributes: add_attr_by_NID %d -> %s (failed)", nid, ZSTR_VAL(str_item));
1088+
php_error_docref(NULL, E_WARNING, "attributes: add_attr_by_NID %d -> %pS (failed)", nid, str_item);
10891089
zend_string_release(str_item);
10901090
return FAILURE;
10911091
}
10921092
zend_string_release(str_item);
10931093
} else {
1094-
php_error_docref(NULL, E_WARNING, "attributes: %s is not a recognized attribute name", ZSTR_VAL(strindex));
1094+
php_error_docref(NULL, E_WARNING, "attributes: %pS is not a recognized attribute name", strindex);
10951095
}
10961096
} ZEND_HASH_FOREACH_END();
10971097
for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++) {

‎ext/openssl/openssl_backend_v1.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static bool php_openssl_pkey_init_ec_data(EC_KEY *eckey, zval *data, bool *is_pr
285285
if (curve_name_zv && Z_TYPE_P(curve_name_zv) == IS_STRING && Z_STRLEN_P(curve_name_zv) > 0) {
286286
int nid = OBJ_sn2nid(Z_STRVAL_P(curve_name_zv));
287287
if (nid == NID_undef) {
288-
php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %s", Z_STRVAL_P(curve_name_zv));
288+
php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %pS", Z_STR_P(curve_name_zv));
289289
goto clean_exit;
290290
}
291291

‎ext/openssl/openssl_backend_v3.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ EVP_PKEY *php_openssl_pkey_init_ec(zval *data, bool *is_private) {
320320
if (curve_name_zv && Z_TYPE_P(curve_name_zv) == IS_STRING && Z_STRLEN_P(curve_name_zv) > 0) {
321321
nid = OBJ_sn2nid(Z_STRVAL_P(curve_name_zv));
322322
if (nid == NID_undef) {
323-
php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %s", Z_STRVAL_P(curve_name_zv));
323+
php_error_docref(NULL, E_WARNING, "Unknown elliptic curve (short) name %pS", Z_STR_P(curve_name_zv));
324324
goto cleanup;
325325
}
326326

‎ext/openssl/xp_ssl.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,8 +1514,8 @@ static zend_result php_openssl_enable_server_sni(
15141514
local_cert_str, resolved_cert_path_buff, 0, false, false,
15151515
"SNI_server_certs local_cert in ssl stream context", stream)) {
15161516
php_stream_warn(stream, OpenFailed,
1517-
"Failed setting local cert chain file `%s'; could not open file",
1518-
ZSTR_VAL(local_cert_str)
1517+
"Failed setting local cert chain file `%pS'; could not open file",
1518+
local_cert_str
15191519
);
15201520
zend_string_release(local_cert_str);
15211521
return FAILURE;
@@ -1539,8 +1539,8 @@ static zend_result php_openssl_enable_server_sni(
15391539
local_pk_str, resolved_pk_path_buff, 0, false, false,
15401540
"SNI_server_certs local_pk in ssl stream context", stream)) {
15411541
php_stream_warn(stream, OpenFailed,
1542-
"Failed setting local private key file `%s'; could not open file",
1543-
ZSTR_VAL(local_pk_str)
1542+
"Failed setting local private key file `%pS'; could not open file",
1543+
local_pk_str
15441544
);
15451545
zend_string_release(local_pk_str);
15461546
return FAILURE;
@@ -1553,8 +1553,8 @@ static zend_result php_openssl_enable_server_sni(
15531553
ctx = php_openssl_create_sni_server_ctx(stream, resolved_path_buff, resolved_path_buff);
15541554
} else {
15551555
php_stream_warn(stream, NotFound,
1556-
"Failed setting local cert chain file `%s'; file not found",
1557-
Z_STRVAL_P(current)
1556+
"Failed setting local cert chain file `%pS'; file not found",
1557+
Z_STR_P(current)
15581558
);
15591559
}
15601560
} else {

0 commit comments

Comments
 (0)