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