#41115 [Opn->Asn]: Memory leak when creating object from empty value
| From: | bjori@php.net | Date: | Mon, 05 Nov 2007 21:42:33 +0000 |
| Subject: | #41115 [Opn->Asn]: Memory leak when creating object from empty value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-119308@lists.php.net to get a copy of this message | ||
ID: 41115
Updated by: bjori@php.net
Reported By: hannes dot magnusson at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5CVS-2007-04-17 (CVS)
Assigned To: stas
Previous Comments:
------------------------------------------------------------------------
[2007-11-05 21:42:16] hannes dot magnusson at gmail dot com
PHP Notice: Indirect modification of overloaded element of foo has no
effect in /home/bjori/php/- on line 16
[Mon Nov 5 22:37:52 2007] Script: '-'
/home/bjori/php/5.3/Zend/zend_execute.c(453) : Freeing 0x086228D8 (16
bytes), script=-
=== Total 1 memory leaks detected ===
------------------------------------------------------------------------
[2007-11-05 21:24:04] stas@php.net
Couldn't reproduce it in neither 5.2 nor 5.3 HEAD. Does it still happen
for you?
------------------------------------------------------------------------
[2007-08-17 23:26:52] jani@php.net
Stas, you seem to have added the code where the leak emits from.. :)
------------------------------------------------------------------------
[2007-04-17 12:08:28] hannes dot magnusson at gmail dot com
Description:
------------
Creating an object from an empty value on overloaded element leaks.
Reproduce code:
---------------
<?php
class foo implements ArrayAccess {
private $array;
public function offsetSet($key, $value) {
$this->array[$key] = $value;
}
public function offsetGet($key) {
return $this->array[$key];
}
public function offsetExists($key) {}
public function offsetUnset($key) {}
}
$foo = new foo;
$foo["bar"] = array();
$foo["bar"][0]->std = "foo";
Actual result:
--------------
Notice: Indirect modification of overloaded element of foo has no
effect in /usr/home/bjori/test/memleak.php on line 16
Strict Standards: Creating default object from empty value in
/usr/home/bjori/test/memleak.php on line 16
[Tue Apr 17 14:02:54 2007] Script: 'memleak.php'
/usr/src/php/5.2/Zend/zend_execute.c(441) : Freeing 0x0850535C (16
bytes), script=memleak.php
=== Total 1 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41115&edit=1