From e053dcc066bbee24bc080363dbb9d3cbc5d24f00 Mon Sep 17 00:00:00 2001 From: Rob Richards Date: Fri, 19 Jan 2007 19:23:20 +0000 Subject: [PATCH] fix accessing public key from x509 resource add test fix test under win32 --- ext/openssl/openssl.c | 7 +++---- ext/openssl/tests/005.phpt | 34 +++++++++++++++++++++++++++++++++ ext/openssl/tests/bug38261.phpt | 4 ++-- 3 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 ext/openssl/tests/005.phpt diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 8865d9bd63..b5fdc348cc 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1945,11 +1945,10 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * /* got the key - return it */ return (EVP_PKEY*)what; } + } else { + /* other types could be used here - eg: file pointers and read in the data from them */ + TMP_CLEAN; } - - /* other types could be used here - eg: file pointers and read in the data from them */ - - TMP_CLEAN; } else { /* force it to be a string and check if it refers to a file */ /* passing non string values leaks, object uses toString, it returns NULL diff --git a/ext/openssl/tests/005.phpt b/ext/openssl/tests/005.phpt new file mode 100644 index 0000000000..069c94580c --- /dev/null +++ b/ext/openssl/tests/005.phpt @@ -0,0 +1,34 @@ +--TEST-- +openSSL: read public key from x.509 resource +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Ok diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt index e7d806083e..b06fa4f8fe 100644 --- a/ext/openssl/tests/bug38261.phpt +++ b/ext/openssl/tests/bug38261.phpt @@ -27,8 +27,8 @@ bool(false) bool(false) bool(false) -Warning: openssl_x509_parse() expects at least 1 parameter, 0 given in %s/bug38261.php on line %d +Warning: openssl_x509_parse() expects at least 1 parameter, 0 given in %sbug38261.php on line %d NULL bool(false) -Catchable fatal error: Object of class stdClass could not be converted to string in %s/bug38261.php on line %d +Catchable fatal error: Object of class stdClass could not be converted to string in %sbug38261.php on line %d -- 2.50.1