mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
fix improper behavior
openssl_spki_export() is documented to return string, but it's obviously not achieved writing it to stdout :)
This commit is contained in:
parent
3d7343f609
commit
c01943bffc
1 changed files with 8 additions and 3 deletions
|
@ -1637,7 +1637,7 @@ PHP_FUNCTION(openssl_spki_export)
|
||||||
|
|
||||||
EVP_PKEY *pkey = NULL;
|
EVP_PKEY *pkey = NULL;
|
||||||
NETSCAPE_SPKI *spki = 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) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &spkstr, &spkstr_len) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
|
@ -1669,8 +1669,13 @@ PHP_FUNCTION(openssl_spki_export)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
out = BIO_new_fp(stdout, BIO_NOCLOSE);
|
out = BIO_new(BIO_s_mem());
|
||||||
PEM_write_bio_PUBKEY(out, pkey);
|
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;
|
goto cleanup;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue