Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45181 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26829 invoked from network); 2 Aug 2009 19:08:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2009 19:08:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=patchnow@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=patchnow@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.224 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: patchnow@gmail.com X-Host-Fingerprint: 209.85.219.224 mail-ew0-f224.google.com Received: from [209.85.219.224] ([209.85.219.224:46735] helo=mail-ew0-f224.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/E6-14439-634E57A4 for ; Sun, 02 Aug 2009 15:08:38 -0400 Received: by ewy24 with SMTP id 24so2384905ewy.23 for ; Sun, 02 Aug 2009 12:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=r6oD6rS0zXSJxwdCRzXi3RDl2C45an/Thf6ljactZT8=; b=lzToAjRbfveWdCBfok4Mfpto51QzCs0QoCZCWA67VhCgQYTciGVnBPnM7Mm/+J64XK vlFW0gL+57mQxmYwryr5lfcEELj6iGadWyETIvNsNrCDc6OxB2RxdmfQT7TFCR+BkAc3 DtXa01qV/UwwunXUGOGOaYuYOqiKEpaXQKZeQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=lCJsGDwjDvhHAPt1iL86pPVfl7fXkQtJkCaOlovow0pZOje/b1X5d0/lUA3M37SKZd WQjgI3Gz07JbkvZFh/HaQAQMYG2jAMErp3xtLds/UWP5CE/DNGp4oBnYvalJZz2FfrA6 YWxQ71LU2EcBg5KkVJBK/a0UHdDcpZa2Eu11c= Received: by 10.210.20.17 with SMTP id 17mr6249601ebt.80.1249240115682; Sun, 02 Aug 2009 12:08:35 -0700 (PDT) Received: from ?192.168.0.80? (xdsl-87-79-147-242.netcologne.de [87.79.147.242]) by mx.google.com with ESMTPS id 28sm7638123eyg.50.2009.08.02.12.08.34 (version=SSLv3 cipher=RC4-MD5); Sun, 02 Aug 2009 12:08:34 -0700 (PDT) Message-ID: <4A75E433.8030909@gmail.com> Date: Sun, 02 Aug 2009 21:08:35 +0200 User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Weak references - object destruction callback? From: patchnow@gmail.com (Oskar Eisemuth) Hi I try to write a a weak reference extension for php5.3 to break circular object structures, so far I have a test implementation that seems to work fine with my first tests. My current system uses a new base class that returns a new resource via a getWeakRef method. This resource can be converted back to a new zval pointing to the object, or returning false if the object already is destroyed. So far so good, basic tests seems to work correct, the zend engine doesn't get screwed. But general I would want to avoid using a base class all together, is there any way to get notified when a object gets out of scope (preferred without changing Zend internals)? I couldn't find a good answer by reading the code, changing the handler tables on the fly doesn't feel like the right solution. I am curious what is the purpose of the zend_objects_proxy apis? Converting resources directly to an object by type cast would be nice and would avoid using a function for this, could this made somehow possible? regards Oskar