From 02fcd9936aceca3f1ecce4e5f1f62e96971c5c29 Mon Sep 17 00:00:00 2001 From: ndossche <7771979+ndossche@users.noreply.github.com> Date: Sat, 7 Mar 2026 15:25:19 +0100 Subject: [PATCH] openssl: Fix missing error propagation in openssl_x509_export() The file writes can have failed, but this error isn't visible for the application, fix it by propagating the error properly. --- ext/openssl/openssl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 2f2aae1e7335b..8a987aab8c0dd 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1872,8 +1872,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);