Bug #69534 [NEW]: Cycle leaks through declared properties on internal classes
From: nikic
Operating system:
PHP version: master-Git-2015-04-26 (Git)
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Cycle leaks through declared properties on internal classes
Description:
------------
This code...
<?php
class Node extends SplObjectStorage {
public $prop;
}
$node1 = new Node;
$node2 = new Node;
$node1->prop = $node2;
$node2->prop = $node1;
...will leaks the Node#1, Node#2 cycle.
"SplObjectStorage" can be replaced with any internal class that
implements a custom get_gc handler and uses the usual "custom data table
+ return std properties" pattern.
The reason is that the GC code no longer checks for INDIRECT elements in
the properties hash and assumes that these elements will also be present
in the data table. This is usually not true for internal objects.
Possible resolutions:
a) Handle INDIRECT in the GC again.
b) Require that the table populated by GC always contains the std
properties table. This would prevent directly returning pointers to
internal tables for classes like SplFixedArray, SplHeap or
ArrayObject/Iterator and instead require maintaining gc_data/gc_data_num
members like we already do in some other places. In this variant the
default get_gc handler should also be changed to ignore custom
get_properties handlers.
--
Edit bug report at https://bugs.php.net/bug.php?id=69534&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69534&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69534&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69534&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69534&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69534&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69534&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69534&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69534&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69534&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69534&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69534&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69534&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69534&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69534&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69534&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69534&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69534&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69534&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69534&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69534&r=mysqlcfg
Thread (3 messages)
- nikic@php.net