com php-src: Rewrite openssl_error_string to use stor ed errors: ext/openssl/openssl.c

From: Date: Tue, 02 Feb 2016 16:26:03 +0000
Subject: com php-src: Rewrite openssl_error_string to use stor ed errors: ext/openssl/openssl.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92446@lists.php.net to get a copy of this message
Commit: c26b87b8ac0548a6cdbb75d3395c8f000836dd69 Author: Jakub Zelenka <bukka@php.net> Tue, 2 Feb 2016 16:26:03 +0000 Parents: ceddf003a716a2d2f6a518cff4de5bb59e5cff54 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c26b87b8ac0548a6cdbb75d3395c8f000836dd69 Log: Rewrite openssl_error_string to use stored errors Changed paths: M ext/openssl/openssl.c Diff: diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 0a83fa5..9615d61 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -5047,16 +5047,25 @@ PHP_FUNCTION(openssl_public_decrypt) Returns a description of the last error, and alters the index of the error messages. Returns false when the are no more messages */ PHP_FUNCTION(openssl_error_string) { - char buf[512]; + char buf[256]; unsigned long val; if (zend_parse_parameters_none() == FAILURE) { return; } - val = ERR_get_error(); + php_openssl_store_errors(); + + if (OPENSSL_G(errors) == NULL || OPENSSL_G(errors)->top == OPENSSL_G(errors)->bottom) { + RETURN_FALSE; + } + + OPENSSL_G(errors)->bottom = (OPENSSL_G(errors)->bottom + 1) % ERR_NUM_ERRORS; + val = OPENSSL_G(errors)->buffer[OPENSSL_G(errors)->bottom]; + if (val) { - RETURN_STRING(ERR_error_string(val, buf)); + ERR_error_string_n(val, buf, 256); + RETURN_STRING(buf); } else { RETURN_FALSE; }

« previous php.cvs (#92446) next »