Skip to content

Commit a0e679e

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: openssl: Fix error propagation in csr exports (#21403) openssl: Fix missing error propagation in openssl_x509_export() (#21375) Fix SKIPIF of openssl_password.phpt (#20941)
2 parents f630a69 + 4d544e4 commit a0e679e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ext/openssl/openssl.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -861,8 +861,7 @@ PHP_FUNCTION(openssl_x509_export)
861861
}
862862
if (!notext && !X509_print(bio_out, cert)) {
863863
php_openssl_store_errors();
864-
}
865-
if (PEM_write_bio_X509(bio_out, cert)) {
864+
} else if (PEM_write_bio_X509(bio_out, cert)) {
866865
BUF_MEM *bio_buf;
867866

868867
BIO_get_mem_ptr(bio_out, &bio_buf);
@@ -1625,9 +1624,9 @@ PHP_FUNCTION(openssl_csr_export_to_file)
16251624
bio_out = BIO_new_file(file_path, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
16261625
if (bio_out != NULL) {
16271626
if (!notext && !X509_REQ_print(bio_out, csr)) {
1627+
/* TODO: warn? */
16281628
php_openssl_store_errors();
1629-
}
1630-
if (!PEM_write_bio_X509_REQ(bio_out, csr)) {
1629+
} else if (!PEM_write_bio_X509_REQ(bio_out, csr)) {
16311630
php_error_docref(NULL, E_WARNING, "Error writing PEM to file %s", file_path);
16321631
php_openssl_store_errors();
16331632
} else {
@@ -1676,9 +1675,7 @@ PHP_FUNCTION(openssl_csr_export)
16761675
bio_out = BIO_new(BIO_s_mem());
16771676
if (!notext && !X509_REQ_print(bio_out, csr)) {
16781677
php_openssl_store_errors();
1679-
}
1680-
1681-
if (PEM_write_bio_X509_REQ(bio_out, csr)) {
1678+
} else if (PEM_write_bio_X509_REQ(bio_out, csr)) {
16821679
BUF_MEM *bio_buf;
16831680

16841681
BIO_get_mem_ptr(bio_out, &bio_buf);

ext/openssl/tests/openssl_password.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ openssl
55
--SKIPIF--
66
<?php
77
if (!function_exists('openssl_password_hash')) {
8-
echo "skip - No openssl_password_hash";
8+
die("skip No openssl_password_hash");
9+
}
10+
if (!defined('PASSWORD_ARGON2_PROVIDER')) {
11+
die("skip No openssl argon2 support");
912
}
1013
?>
1114
--FILE--

0 commit comments

Comments
 (0)