[php-src] Issue #12835: Memory leak with __call magic method

From: Date: Thu, 30 Nov 2023 11:54:08 +0000
Subject: [php-src] Issue #12835: Memory leak with __call magic method
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245941@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12835 Author: matyhtf ### Description The following code: ```c ZEND_METHOD(MyObject, __call) { char *name; size_t l_name; zval *arguments; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STRING(name, l_name) Z_PARAM_ARRAY(arguments) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); } ``` ```php $obj = new MyObject; $obj->test('a', 'b', name: 'hello'); ``` Resulted in this output: ``` [Thu Nov 30 19:40:54 2023] Script: '/home/htf/workspace/python-php/main.php' /home/htf/soft/php-8.1.23/Zend/zend_hash.c(281) : Freeing 0x00007ff473b10000 (56 bytes), script=/home/htf/workspace/main.php Last leak repeated 4 times [Thu Nov 30 19:40:54 2023] Script: 'script=/home/htf/workspace/main.php' Zend/zend_string.h(152) : Freeing 0x00007ff473b11000 (224 bytes), script=/home/htf/workspace/python-php/main.php Last leak repeated 4 times [Thu Nov 30 19:40:54 2023] Script: '/home/htf/workspace/main.php' /home/htf/soft/php-8.1.23/Zend/zend_hash.c(174) : Freeing 0x00007ff473be7980 (320 bytes), script=/home/htf/workspace/main.php Last leak repeated 4 times === Total 15 memory leaks detected === ``` But I expected this output instead: ``` no memory leak ``` ### PHP Version PHP 8.1.23 ### Operating System _No response_

« previous php.bugs (#245941) next »