|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70299 Memleak while assigning object offsetGet result
Submitted: 2015-08-19 02:51 UTC Modified: 2015-08-19 02:57 UTC
From: Assigned: laruence (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0.0beta3 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
8 + 38 = ?
Subscribe to this entry?

 [2015-08-19 02:51 UTC]
this bug is fixed already by me last night while try to to fix SEND_REF bug #70288

anyway, it's better to have a bug entry for the record 

Test script:
class MyTree implements ArrayAccess {
    public $children = array();

    public function offsetExists($offset) {

    public function offsetUnset($offset) {

    public function offsetSet($offset, $value) {
        $this->children[$offset] = $value;

    public function offsetGet($offset) {
        return $this->children[$offset];


$root = new MyTree();
$root[0] = new MyTree();
$a  = &$root[0];
$b  = &$root[0];
$c  = &$root[0];
$d  = &$root[0];

Expected result:
non memory leak

Actual result:
[Wed Aug 19 10:43:57 2015]  Script:  '/tmp/1.php'
/home/huixinchen/opensource/github/php-src/Zend/zend_objects.c(161) :  Freeing 0x7F2E4145A4E0 (56 bytes), script=/tmp/1.php
[Wed Aug 19 10:43:57 2015]  Script:  '/tmp/1.php'
/home/huixinchen/opensource/github/php-src/Zend/zend_execute.c(543) :  Freeing 0x7F2E414730A8 (24 bytes), script=/tmp/1.php
Last leak repeated 3 times
=== Total 5 memory leaks detected ===


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-19 02:57 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2015-08-19 02:57 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Aug 18 14:04:04 2022 UTC