Bug #80049 [Opn]: memleak when coercing integers to string

From: Date: Thu, 03 Sep 2020 14:45:51 +0000
Subject: Bug #80049 [Opn]: memleak when coercing integers to string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228863@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 Status: Open Type: Bug Package: *General Issues Operating System: archLinux PHP Version: 8.0.0beta3 Block user comment: N Private report: N New Comment: Small additional reduction: <?php function coerceToString(string ...$strings) { var_dump($strings); } coerceToString(...[123]); Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#228863) next »