Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95021 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47615 invoked from network); 10 Aug 2016 18:38:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Aug 2016 18:38:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=michal@brzuchalski.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=michal@brzuchalski.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain brzuchalski.com designates 188.165.245.118 as permitted sender) X-PHP-List-Original-Sender: michal@brzuchalski.com X-Host-Fingerprint: 188.165.245.118 ns220893.ip-188-165-245.eu Received: from [188.165.245.118] ([188.165.245.118:53163] helo=poczta.brzuchalski.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/B2-32735-7A47BA75 for ; Wed, 10 Aug 2016 14:38:33 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by poczta.brzuchalski.com (Postfix) with ESMTP id 8B4A4298423D for ; Wed, 10 Aug 2016 20:38:27 +0200 (CEST) Received: from poczta.brzuchalski.com ([127.0.0.1]) by localhost (poczta.brzuchalski.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WxPE5444SpZ3 for ; Wed, 10 Aug 2016 20:38:23 +0200 (CEST) Received: from mail-qt0-f178.google.com (unknown [209.85.216.178]) by poczta.brzuchalski.com (Postfix) with ESMTPSA id 800F7298423A for ; Wed, 10 Aug 2016 20:38:23 +0200 (CEST) Received: by mail-qt0-f178.google.com with SMTP id 52so25192509qtq.3 for ; Wed, 10 Aug 2016 11:38:23 -0700 (PDT) X-Gm-Message-State: AEkooutsbXy1MV3NilNUCkvEg3AH+lWZ4tkCUN5CIlpsAd46tIky+lsCBIxhDxaIb5bME79YVMr9ybJt2Mnv8A== X-Received: by 10.237.51.71 with SMTP id u65mr6175155qtd.111.1470854302575; Wed, 10 Aug 2016 11:38:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.53.155 with HTTP; Wed, 10 Aug 2016 11:38:22 -0700 (PDT) In-Reply-To: <16fdbdc7-bad4-f978-32e9-e4bf7443e592@gmx.de> References: <9e9c440e-05d2-a452-556e-a6c62a9f195e@gmx.de> <208237ee-a22a-97b7-be63-f7cba986b137@fleshgrinder.com> <16fdbdc7-bad4-f978-32e9-e4bf7443e592@gmx.de> Date: Wed, 10 Aug 2016 20:38:22 +0200 X-Gmail-Original-Message-ID: Message-ID: To: "Christoph M. Becker" Cc: PHP Internals List , Nikita Popov Content-Type: multipart/alternative; boundary=94eb2c0a879a38bad20539bbf42a Subject: Re: [PHP-DEV] GC issue wrt. to resource <-> object cycles? From: michal@brzuchalski.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --94eb2c0a879a38bad20539bbf42a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Maybe it's a good idea to move them to another ext, and then move xmlparser back to PECL ? 2016-08-10 20:23 GMT+02:00 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 th= at > >> 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 avoi= d > >> further confusion), in the following a (shallow) copy of the object is > >> made, and apparently due to the additional refcount in the object stor= e > >> 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 o= f > >> 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] > >> refsect1-function.xml-set-object-examples> > > > > 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 an= d > > 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 =E2=80=93 we already have iconv, mbstrin= g 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 pozdrawiam -- Micha=C5=82 Brzuchalski --94eb2c0a879a38bad20539bbf42a--