Merge branch 'PHP-7.0' into PHP-7.1
authorJakub Zelenka <bukka@php.net>
Sun, 15 Oct 2017 19:31:25 +0000 (20:31 +0100)
committerJakub Zelenka <bukka@php.net>
Sun, 15 Oct 2017 19:31:25 +0000 (20:31 +0100)
1  2 
NEWS
ext/openssl/openssl.c

diff --cc NEWS
Simple merge
index b199e0a68c9154108eb74b10c86049b38131508a,9b8a2fc96820083d378ac47e8928be1229acc3f4..b5b0e87b54b89cc5b50b470b9cd32dd975f3477a
@@@ -1758,16 -1672,13 +1757,16 @@@ PHP_FUNCTION(openssl_x509_export_to_fil
  
                RETVAL_TRUE;
        } else {
 +              php_openssl_store_errors();
                php_error_docref(NULL, E_WARNING, "error opening file %s", filename);
        }
-       if (certresource == NULL && cert) {
+       if (Z_TYPE_P(zcert) != IS_RESOURCE) {
                X509_free(cert);
        }
 -      BIO_free(bio_out);
 +
 +      if (!BIO_free(bio_out)) {
 +              php_openssl_store_errors();
 +      }
  }
  /* }}} */
  
@@@ -2099,16 -1991,12 +2097,16 @@@ PHP_FUNCTION(openssl_x509_export
                ZVAL_STRINGL(zout, bio_buf->data, bio_buf->length);
  
                RETVAL_TRUE;
 +      } else {
 +              php_openssl_store_errors();
        }
  
-       if (certresource == NULL && cert != NULL) {
 +      BIO_free(bio_out);
 +
 +cleanup:
+       if (Z_TYPE_P(zcert) != IS_RESOURCE) {
                X509_free(cert);
        }
 -      BIO_free(bio_out);
  }
  /* }}} */
  
@@@ -2775,8 -2642,7 +2776,8 @@@ PHP_FUNCTION(openssl_pkcs12_export_to_f
                php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
                goto cleanup;
        }
-       if (cert && !X509_check_private_key(cert, priv_key)) {
+       if (!X509_check_private_key(cert, priv_key)) {
 +              php_openssl_store_errors();
                php_error_docref(NULL, E_WARNING, "private key does not correspond to cert");
                goto cleanup;
        }