[php-src] PR #24138: Zend: fix memory leak in array_map
| From: | adapik | Date: | Mon, 05 Oct 2026 15:18:22 +0000 |
| Subject: | [php-src] PR #24138: Zend: fix memory leak in array_map | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39170@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24138
Author: adapik
zend_compile_func_array_map() takes an extra reference on a constant array argument
because it is used by both ZEND_TYPE_ASSERT and ZEND_FE_RESET_R. For a
non-interned string literal the refcount becomes 2, so the later
zval_make_interned_string() copies the string and leaks the original:
```
array_map(strtoupper(...), "str"); // TypeError, then a leak report
```