com php-src: fix improper behavior: ext/openssl/openssl.c

From: Date: Fri, 03 Jul 2015 08:15:52 +0000
Subject: com php-src: fix improper behavior: ext/openssl/openssl.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87723@lists.php.net to get a copy of this message
Commit: c01943bffc8b719e552d307f522820d50f783a4c Author: Anatol Belski <ab@php.net> Fri, 3 Jul 2015 10:15:52 +0200 Parents: 3d7343f609b81ebac95d94480a2615df530806e7 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c01943bffc8b719e552d307f522820d50f783a4c Log: fix improper behavior openssl_spki_export() is documented to return string, but it's obviously not achieved writing it to stdout :) Changed paths: M ext/openssl/openssl.c Diff: diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index ebbc877..b3ef5ad 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1637,7 +1637,7 @@ PHP_FUNCTION(openssl_spki_export) EVP_PKEY *pkey = NULL; NETSCAPE_SPKI *spki = NULL; - BIO *out = BIO_new(BIO_s_mem()); + BIO *out = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &spkstr, &spkstr_len) == FAILURE) { return; @@ -1669,8 +1669,13 @@ PHP_FUNCTION(openssl_spki_export) goto cleanup; } - out = BIO_new_fp(stdout, BIO_NOCLOSE); - PEM_write_bio_PUBKEY(out, pkey); + out = BIO_new(BIO_s_mem()); + if (out && PEM_write_bio_PUBKEY(out, pkey)) { + BUF_MEM *bio_buf; + + BIO_get_mem_ptr(out, &bio_buf); + RETVAL_STRINGL((char *)bio_buf->data, bio_buf->length); + } goto cleanup; cleanup:

« previous php.cvs (#87723) next »