Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95020 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45665 invoked from network); 10 Aug 2016 18:24:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Aug 2016 18:24:01 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.22 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.22 mout.gmx.net Received: from [212.227.17.22] ([212.227.17.22:62225] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/52-32735-E317BA75 for ; Wed, 10 Aug 2016 14:24:00 -0400 Received: from [192.168.2.103] ([217.82.227.154]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0Mh9cj-1btBeN3kNV-00MNaO; Wed, 10 Aug 2016 20:23:55 +0200 To: internals@lists.php.net, Nikita Popov References: <9e9c440e-05d2-a452-556e-a6c62a9f195e@gmx.de> <208237ee-a22a-97b7-be63-f7cba986b137@fleshgrinder.com> Message-ID: <16fdbdc7-bad4-f978-32e9-e4bf7443e592@gmx.de> Date: Wed, 10 Aug 2016 20:23:57 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <208237ee-a22a-97b7-be63-f7cba986b137@fleshgrinder.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:X6/i/W18EflOIbNv4t028p0yZ8mJG+6/dEIX0yH/YiGKBtvwE04 eMyjzUEGU8aZ7STJrdva0czVtzlOGyfosK09ggYGDgcaukI5eBeWDB8/LGh/UjLrIMcfMvw DqQOZZMTKTGOwUHnR5QIgTrEDQTFoI24nQYO2fCZE2kh+j2XN/QygFRv4wWVZQkdTbNf2Ky rM8VCKpZRiXAKmXHCzymQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:Dwd1bXuK9c8=:yrq6Z2/UkW0x9OTBHpnjNH yJO8Q8zkQdaXM57ZLOz54C5mSzOmtbJRCvTYiWBBiUyUCx7iGIEpk1+c2e+K9YlO/7cUmst6L HiMcWBZSC2HuyLDr19uPB02FRy9myIsqc4W+y87Fo1Qmg6ee+su5tQUvJ02TuRJ/rJOKehkwR r26Dsli0akjuz/f+048iMDArdK5FvDQiBTDX+thTIFjz4S/w3btdTnxjkpgwBW0VddmGdV1Ws vuZak8hsGimeozGLyARJfsBS7y8iY2qDqS5D0C/iFMzCkjCCNcYm8LERltO0Fm0pdbElIf7Fb QP+wHNf3ouENPa/LWcxjsfq6RNTraKc66fiUl1ftIIeC/kkpe9CHCkupMiwZKDM5AnH5qk9Pr JckH5BtYp48bfmrAJUE+SYmUH5/aKU/XdlyzFqyvmIMawM5x435auu8fJkmz7TyLkE4ycZa1F NRcyKmtoL6Yk+GuymvFmhXH8WZzKUw30EkBwK1l6ZTgnoPbToJ5Pkz9GL1EOjFvOiLAfyMhDv R773llLZGNDwvjgFPCkNdN7C2w97vEn2jmtqNVlWSxxG+K6ByiV6xIh96B1tdI9URr2+Ruv3i XbJ9Hxggt83lvQFmhSXXrZAHUBVICJWqNCkqgLVaFVcY19/MnQcztT9sgI/CujN1xK7KLoU9+ 3NGHUSQBXGhmRLHSlK7caPNNvsBGhG2Vvv0NCGjWQcpTYkkmpnSbRhANQdACp2tMyxWXRVX3r TxlXfb35FeTGEW6txB994Gb7jZNob6rx6qTPY6PMh12oqMyKBfvp8bsQ2hzUoPnsSZcupMBLh tnsqVd+ Subject: Re: [PHP-DEV] GC issue wrt. to resource <-> object cycles? From: cmbecker69@gmx.de ("Christoph M. Becker") On 10.08.2016 at 19:34, Fleshgrinder wrote: > On 8/10/2016 4:17 PM, Christoph M. Becker wrote: >> On 10.08.2016 at 12:59, Nikita Popov wrote: >> >>> The simplest way to fix ext/xml in particular is probably to migrate it to >>> use an object instead of a resource. >> >> I guess that is the best action in the long run (i.e. 7.2+), but that >> would of course cause a BC break, so probably it's best to document that >> the user has to break the cycle manually, if xml_set_object() is used >> (7.0, 7.1). >> >> Wrt. to PHP 5.6 it appears there are no issues at all. While the code >> out-commented by Thies is still there (which should be removed to avoid >> further confusion), in the following a (shallow) copy of the object is >> made, and apparently due to the additional refcount in the object store >> of PHP 5, everything is okay. >> >> Another alternative for PHP 7.2 might be to drop (after deprecation) >> xml_set_object(); actually, it seems to me this function is a relict of >> pre PHP 5. Cf. example #1[1]. Instead of doing: >> >> xml_set_object($this->parser, $this); >> xml_set_element_handler($this->parser, "tag_open", "tag_close"); >> >> one could simply do: >> >> xml_set_element_handler($this->parser, >> [$this, "tag_open"], [$this, "tag_close]); >> >> [1] >> > > It does not have to be a BC if we simply introduce a new API for this > extension and keep the old one as is. The whole set of functions just > cries out loud for a class that encapsulates the state of the parser and > both the utf8_* functions simply do not belong in this extension. That might be a good idea, even if we already have the XMLReader. And yes, the utf8_* functions don't really belong into ext/xml; frankly, I think they don't belong anywhere – we already have iconv, mbstring and recode which offer a subset of utf8_decode()/utf8_encode. OTOH, utf8_decode()/_encode() appear to be often used (IIRC there are a lot of user notes suggesting to use these functions). -- Christoph M. Becker