Perhaps you could use your own reference counting?
Keep your "real" objects in private array and instead of returning them return
a simple object which would forward all methods and properties by
__get/__set/__call. The constructor would increase your internal refcount by
one, destructor would decrease it.
I use those objects quite often as they are used to access the database
to manipulate or search for related data. It wouldn't perform well and
is actually not at all practicable because there are so many classes for
which I'd would have to copy the interface.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php