Bug #80049 [Opn->Csd]: Memleak when coercing integers to string via variadic argument
| From: | nikic@php.net | Date: | Thu, 03 Sep 2020 15:14:16 +0000 |
| Subject: | Bug #80049 [Opn->Csd]: Memleak when coercing integers to string via variadic argument | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228864@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80049&edit=1
ID: 80049
Updated by: nikic@php.net
Reported by: sjon@php.net
Summary: Memleak when coercing integers to string via
variadic argument
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: archLinux
PHP Version: 8.0.0beta3
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=46a49be6c866103ebcb95e03b2b96460bec16b7b
Log: Fixed bug #80049
Previous Comments:
------------------------------------------------------------------------
[2020-09-03 14:45:51] nikic@php.net
Small additional reduction:
<?php
function coerceToString(string ...$strings) {
var_dump($strings);
}
coerceToString(...[123]);
------------------------------------------------------------------------
[2020-09-03 14:38:37] sjon@php.net
Description:
------------
I hope this fixes the majority of the 900 memleaks we currently have in our application
Test script:
---------------
class sa
{
public static function coerceTo(string $type, array $array): array
{
return self::_coerceToString(...array_values($array));
}
protected static function _coerceToString(string ...$strings): array
{
return $strings;
}
}
sa::coerceTo("string", ['nl' => 0.9, 'be' => 0.2]);
Actual result:
--------------
Zend/zend_string.h(141) : Freeing 0x00007fb91a281300 (224 bytes), script=/tmp/memleak.php
Last leak repeated 1 time
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80049&edit=1