From f9d4b1a3f10765bae8e6a7ce950daaaf90f983f0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 1 Oct 2016 19:03:54 +0200 Subject: Fix leak in zend_exception_error Only occurs if a non-fatal severity level is used, e.g. when using interactive mode. --- Zend/zend_exceptions.c | 4 ++-- 1 file 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); } /* }}} */ -- cgit v1.2.1