Commit 7831244633d for php.net
commit 7831244633d0f514f3f07875f4cbc4e3343edef4
Author: Nora Dossche <7771979+ndossche@users.noreply.github.com>
Date: Fri Apr 3 22:43:31 2026 +0200
openssl: Fix missing error propagation in openssl_x509_export() (#21375)
The file writes can have failed, but this error isn't visible for the application,
fix it by propagating the error properly.
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 7e6638f7fd2..f5869a8999d 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1869,8 +1869,7 @@ PHP_FUNCTION(openssl_x509_export)
}
if (!notext && !X509_print(bio_out, cert)) {
php_openssl_store_errors();
- }
- if (PEM_write_bio_X509(bio_out, cert)) {
+ } else if (PEM_write_bio_X509(bio_out, cert)) {
BUF_MEM *bio_buf;
BIO_get_mem_ptr(bio_out, &bio_buf);