Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104363 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 15632 invoked from network); 12 Feb 2019 19:06:33 -0000 Received: from unknown (HELO mout.gmx.net) (212.227.15.19) by pb1.pair.com with SMTP; 12 Feb 2019 19:06:33 -0000 Received: from [192.168.2.104] ([79.222.45.201]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MhAAr-1ggblm15Pt-00MOyx; Tue, 12 Feb 2019 16:49:27 +0100 To: Nikita Popov , PHP internals References: Message-ID: <5029d353-53ba-37e5-c5cd-1e5e0e2edab5@gmx.de> Date: Tue, 12 Feb 2019 16:49:26 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:VWAhvsLCBHCeZf/gD4LMxhS1c+f4AgPmY3anPNFPygRRcCtBp5S IWbJixJC6zne4d7kl0taBWOiwhRk/yq/prVbwDHu7GPplcISKn8pFZY7CCjcmSPXHiX6rN/ JbHp5froQNjUwVZJKtfqtzDnY4zlf5SO5gGDrk8nFJM/tHTLVAiutvVRydxwBc7twacuyyX z4wfjt9fN6moUX2hWmS8A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:x4TOvYmt588=:on4S/7ScC5EEIHDTMjSEuR 67qujIJfzDsLtFbYUK9Fna033V14BovWQ6SUDuMy6t+u1lFdyV86m8kBdGQO9zLvCnXAHwvbL T2KxK4ZSaIT64dW40QeszydRsMSphzWno4tj0z6wYH8Bqs7Ien1naUqRwftCWQc0l+JwvDGEH hpEiPsRZKhI6yezTGC0i2W+8YgcphaLhgKQ0ie2+4cWRu9v+9Zusy+kt7PJLVBpxYfkZKaPuX a+dk49sFf/N/N68PFRav0FRnfVTC78emt0kYRfY/r81QzaPLNVPcEP/hnyHrPo4DZr9nmGdrS XfkPtzZohTqhONekeiiML6AXu0nSOK4+akQMIW777IUXRhMft4DElbmFaEifDdUebBWnwLc9C A2wd4vmFuIpru0Eo9xWaGKthe5jOmVNhgPYmX+KSumpXSuWWkqOCknorhBTq28vM0PDEmhCv4 JAjYnd6O2t7WF61SyZl6eLT2nudsVmmkwHmuwms5CrEDjSMxeLFZNW9zsycFOBZ7FDaNEKuIX xRyJrZ2kiu0onC6/yQ2Gd/HAQRRLT6prBQ3OWwxo5yogU6/u2hOHX57+BkfZ/g0ZB7/CpowYG 78EUCaDvqIg8CJH4rnsOixGuCtbmbr2JdRIx3BCSa/FTMDc8PdiYJoXZKMt8dj22KeSwbPqBH 448y2cdhmIOAARuTa3ad7hc5lkpdmCTOP7ZIuxe3lgNboMCQWXkYlzc7NHlGmEnSaN6uEZKyp 6/k/BzsGu52AzqlJgvuL1MBsZQ7RmmADqwcuq1erHjAiUavXuxgZtVdxLmhAxf0MS3jzsXUJo 9s7Vl4yG4VdfJTzD13MjmD8X/7XNMSC+hrUHQR74z3A6f/8Y6vgbgkXefVLMYHjKAqQ02LGlq pyeNqllu+WZ5vUTOlB/8loi5AfrhlHr+flGJEKuGnYPTVYkjBaC9qziJGle5kda2yw4JVTzi2 Ia47suqGnPw== Subject: Re: Convert ext/xml to use an object instead of resource From: cmbecker69@gmx.de ("Christoph M. Becker") On 12.02.2019 at 16:00, Nikita Popov wrote: > The ext/xml extension currently has GC issues, see > https://bugs.php.net/bug.php?id=76874. The tl;dr is that uses of xml_parser > will usually result in a cyclic structure, but resources do not support > cycle GC. This means that the user is required to take care of breaking GC > cycles manually, which is very unusual for PHP. > > I would like to port the xml extension from using a resources towards using > an object, which is fully GC integrated. This is implemented in > https://github.com/php/php-src/pull/3526. > > An XmlParser class is used instead of a resource. The class is final and > cannot be manually constructed. It is still used with the normal > xml_parser_* APIs. This is intended as an internal representation change, > not a conversion to OO APIs. The xml_parser_free() method becomes > effectively a no-op and may be deprecated in some future version. > > This change is intended for PHP 7.4. While it is technically BC breaking > (in that code that goes out of the way to use is_resource or similar may > break), but we've done a couple of these resource->object migration in > minor versions in the past (ref > https://wiki.php.net/rfc/operator_overloading_gmp and > https://wiki.php.net/rfc/hash-context.as-resource). > > Any thoughts? I'm all for switching to objects in 7.4. I'm a bit concerned regarding the name of the new `XmlParser` class, though, since the xml_set_object() (a terrible API, by the way) example[1] uses exactly this class name, and there may be quite some code which followed suit. Maybe we should call the class `XMLPushParser`, although that would be inconsistent with functions like xml_parser_create(). [1] -- Christoph M. Becker