@@ -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 );
0 commit comments