Req #52318 [Opn]: Weak references for PHP
| From: | brendel at krumedia dot de | Date: | Wed, 14 Jul 2010 08:15:36 +0000 |
| Subject: | Req #52318 [Opn]: Weak references for PHP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152395@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52318&edit=1
ID: 52318
User updated by: brendel at krumedia dot de
Reported by: brendel at krumedia dot de
Summary: Weak references for PHP
Status: Open
Type: Feature/Change Request
Package: Scripting Engine problem
PHP Version: Irrelevant
New Comment:
(Edit: It's the Dictionary class of Actionscript 3 instead of the Vector
class.)
Previous Comments:
------------------------------------------------------------------------
[2010-07-12 17:22:30] brendel at krumedia dot de
Description:
------------
PHP should introduce weak references like other languages have for
example the Vector class of Actionscript 3, WeakReference class of Java
or boost's shared_pointer.
This would help PHP CLI programs and other complex PHP scripts. For
example, the Doctrine Project implements the Row Data Gateway Design
Pattern and therefore use an internal repository (cache of record
objects) to guarantee that only one object per table row exists. The
cache has no chance to free objects that are no longer in use. So, a
free() method is provided that will clean up all relations and remove
parts from the repository. But this is no good solution to the problem:
freeing will lead to bugs because other code might rely on some of the
freed objects but they are no longer intact.
Thanks for reading
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52318&edit=1