From: Operating system: PHP version: 5.3.2 Package: Unknown/Other Function Bug Type: Feature/Change Request Bug description:get_object_by_id and get_object_id
Description: ------------ Requesting new functions: get_object_id() to get identifier of the object like in var_dump() (Object #XXX) get_object_by_id() to get object by identifier Related bug in test script Test script: --------------- class a{ protected $b; public function __construct($b){ $this->b = $b; } } class b{ } $b = new b() $a = new a($b); unset($b); // __destruct will not be called because of link left in $a Expected result: ---------------- class a{ protected $b; public function __construct($b){ $this->b = get_object_id($b); // integer } public function getB(){ return get_object_by_id($this->b); } } class b{ } $b = new b() $a = new a($b); var_dump($a->getB()); // Object # unset($b); // __destruct will be called because no links left var_dump($a->getB()); // boolean false -- Edit bug report at http://bugs.php.net/bug.php?id=52182&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52182&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52182&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52182&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52182&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52182&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52182&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52182&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52182&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52182&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52182&r=support Expected behavior: http://bugs.php.net/fix.php?id=52182&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52182&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52182&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52182&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52182&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52182&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52182&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52182&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52182&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52182&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52182&r=mysqlcfg