Skip to content

Commit 4d544e4

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: 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 1c94175 + 4a16d22 commit 4d544e4

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
@@ -863,8 +863,7 @@ PHP_FUNCTION(openssl_x509_export)
863863
}
864864
if (!notext && !X509_print(bio_out, cert)) {
865865
php_openssl_store_errors();
866-
}
867-
if (PEM_write_bio_X509(bio_out, cert)) {
866+
} else if (PEM_write_bio_X509(bio_out, cert)) {
868867
BUF_MEM *bio_buf;
869868

870869
BIO_get_mem_ptr(bio_out, &bio_buf);
@@ -1607,9 +1606,9 @@ PHP_FUNCTION(openssl_csr_export_to_file)
16071606
bio_out = BIO_new_file(file_path, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
16081607
if (bio_out != NULL) {
16091608
if (!notext && !X509_REQ_print(bio_out, csr)) {
1609+
/* TODO: warn? */
16101610
php_openssl_store_errors();
1611-
}
1612-
if (!PEM_write_bio_X509_REQ(bio_out, csr)) {
1611+
} else if (!PEM_write_bio_X509_REQ(bio_out, csr)) {
16131612
php_error_docref(NULL, E_WARNING, "Error writing PEM to file %s", file_path);
16141613
php_openssl_store_errors();
16151614
} else {
@@ -1658,9 +1657,7 @@ PHP_FUNCTION(openssl_csr_export)
16581657
bio_out = BIO_new(BIO_s_mem());
16591658
if (!notext && !X509_REQ_print(bio_out, csr)) {
16601659
php_openssl_store_errors();
1661-
}
1662-
1663-
if (PEM_write_bio_X509_REQ(bio_out, csr)) {
1660+
} else if (PEM_write_bio_X509_REQ(bio_out, csr)) {
16641661
BUF_MEM *bio_buf;
16651662

16661663
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)