Bug #70299 [NEW]: Memleak while assigning object offsetGet result

From: Date: Wed, 19 Aug 2015 02:51:55 +0000
Subject: Bug #70299 [NEW]: Memleak while assigning object offsetGet result
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195320@lists.php.net to get a copy of this message
From: laruence Operating system: PHP version: 7.0.0beta3 Package: Scripting Engine problem Bug Type: Bug Bug description:Memleak while assigning object offsetGet result Description: ------------ 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: --------------- <?php 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 === -- Edit bug report at https://bugs.php.net/bug.php?id=70299&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70299&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70299&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70299&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70299&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70299&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70299&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70299&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70299&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70299&r=support Expected behavior: https://bugs.php.net/fix.php?id=70299&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70299&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70299&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70299&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70299&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70299&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70299&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70299&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70299&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70299&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70299&r=mysqlcfg

« previous php.bugs (#195320) next »