php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79951 Memory leak in str_replace of empty string
Submitted: 2020-08-10 22:31 UTC Modified: 2020-08-11 08:28 UTC
From: changochen1 at gmail dot com Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 8.0Git-2020-08-10 (Git) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: changochen1 at gmail dot com
New email:
PHP Version: OS:

 

 [2020-08-10 22:31 UTC] changochen1 at gmail dot com
Description:
------------
We found a memory leak in PHP. Please refer to the POC.

Test script:
---------------
<?
$a = array (   4 ,   1 , $a , 1 , 1.500000 , 7 , false , 'x' , 'x' , 500    ) ;
foreach ( $a as $b )   str_replace ( $GLOBALS , $a , $a )  ;


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-08-11 07:15 UTC] sjon@php.net
this seems to have been fixed in 8.0alpha3 already, see https://3v4l.org/2vhhJ#v800alpha1
 [2020-08-11 08:26 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2020-08-11 08:26 UTC] nikic@php.net
Reduced:

<?php
str_replace([""], [1000], "foo");
 [2020-08-11 08:28 UTC] nikic@php.net
-Summary: Memory leak in zend_string +Summary: Memory leak in str_replace of empty string
 [2020-08-11 08:37 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9d9dffe60aee0fb469ee0d414eca2a5033a7eafc
Log: Fixed bug #79951
 [2020-08-11 08:37 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 16:01:23 2020 UTC