diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Zend/tests/bug80045.phpt | 22 | ||||
-rw-r--r-- | Zend/zend_builtin_functions.c | 2 |
3 files changed, 26 insertions, 0 deletions
@@ -5,6 +5,8 @@ PHP NEWS - Core: . Implement #[Attr] Attribute syntax as per final vote in RFC https://wiki.php.net/rfc/shorter_attribute_syntax_change + . Fixed bug #80045 (memleak after two set_exception_handler calls with + __call). (Nikita) 03 Sep 2020, PHP 8.0.0beta3 diff --git a/Zend/tests/bug80045.phpt b/Zend/tests/bug80045.phpt new file mode 100644 index 0000000000..b53b8b0c2a --- /dev/null +++ b/Zend/tests/bug80045.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #80045: memleak after two set_exception_handler calls with __call +--FILE-- +<?php + +class x { + public function __construct(){ + set_exception_handler([$this, 'dummyExceptionHandler']); + set_exception_handler([$this, 'dummyExceptionHandler']); + set_error_handler([$this, 'dummyErrorHandler']); + set_error_handler([$this, 'dummyErrorHandler']); + } + + public function __call($m, $p) {} +} + +new x; + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index c3a2a1b63f..906f0666ed 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1198,6 +1198,7 @@ ZEND_FUNCTION(set_error_handler) ZVAL_COPY(&EG(user_error_handler), &(fci.function_name)); EG(user_error_handler_error_reporting) = (int)error_type; + zend_release_fcall_info_cache(&fcc); } /* }}} */ @@ -1253,6 +1254,7 @@ ZEND_FUNCTION(set_exception_handler) } ZVAL_COPY(&EG(user_exception_handler), &(fci.function_name)); + zend_release_fcall_info_cache(&fcc); } /* }}} */ |