summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2016-10-01 19:03:54 +0200
committerNikita Popov <nikic@php.net>2016-10-01 19:04:31 +0200
commitf9d4b1a3f10765bae8e6a7ce950daaaf90f983f0 (patch)
treefa98c765e0032453b1f4ab260a4b327e41d9a2f5
parent9acfb1a3a5268febb123b7e5fbd4eaf072c83537 (diff)
downloadphp-git-f9d4b1a3f10765bae8e6a7ce950daaaf90f983f0.tar.gz
Fix leak in zend_exception_error
Only occurs if a non-fatal severity level is used, e.g. when using interactive mode.
-rw-r--r--Zend/zend_exceptions.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index fda4d21e03..95d18f45fb 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -893,11 +893,10 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f
ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce_exception = Z_OBJCE_P(exception);
+ EG(exception) = NULL;
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
zval *str, *file, *line;
- EG(exception) = NULL;
-
zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring", &str);
if (!EG(exception)) {
if (Z_TYPE_P(str) != IS_STRING) {
@@ -936,6 +935,7 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
} else {
zend_error(severity, "Uncaught exception '%s'", ce_exception->name);
}
+ zval_ptr_dtor(&exception);
}
/* }}} */