php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69201 Memory leak using iterator and get by reference on PHP 7
Submitted: 2015-03-08 04:36 UTC Modified: -
From: jrbasso at gmail dot com Assigned:
Status: Closed Package: SPL related
PHP Version: master-Git-2015-03-08 (Git) OS: Any
Private report: No CVE-ID: None
 [2015-03-08 04:36 UTC] jrbasso at gmail dot com
Description:
------------
Compiling PHP in debug mode and running the code from http://3v4l.org/pb3a2 shows a memory leak at the end. It doesn't happen on stable versions of PHP 5.6.

This get worst when the returned value is a string, as you can see on http://3v4l.org/S3fTZ. If you check the results you will see &string(1747940472) instead of string(11) like the other versions.
Depending the functions you use after this you get the warning about the string not-zero terminated.

Expected result:
----------------
object(Entity)#1 (1) {
  ["_properties":protected]=>
  array(1) {
    ["foo"]=>
    string(6) " world"
  }
}

Actual result:
--------------
object(Entity)#1 (1) {
  ["_properties":protected]=>
  array(1) {
    ["foo"]=>
    string(6) " world"
  }
}
[Sun Mar  8 03:59:48 2015]  Script:  '/home/vagrant/shared/test2.php'
/home/vagrant/shared/php-src/Zend/zend_vm_execute.h(24234) :  Freeing 0x7FFAD80751C0 (24 bytes), script=/home/vagrant/shared/test2.php

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-08 12:22 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5aebdc98dea1f15993c21eefa25f83383b6e2389
Log: Fixed bug #69201 (Memory leak using iterator and get by reference on PHP 7)
 [2015-03-08 12:22 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:39 UTC] davey@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5aebdc98dea1f15993c21eefa25f83383b6e2389
Log: Fixed bug #69201 (Memory leak using iterator and get by reference on PHP 7)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC