Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:104855
Return-Path: <nikita.ppv@gmail.com>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 12127 invoked from network); 21 Mar 2019 17:47:30 -0000
Received: from unknown (HELO mail-it1-f180.google.com) (209.85.166.180)
  by pb1.pair.com with SMTP; 21 Mar 2019 17:47:30 -0000
Received: by mail-it1-f180.google.com with SMTP id z126so4567618itd.5
        for <internals@lists.php.net>; Thu, 21 Mar 2019 07:39:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
        bh=bsyLzBZpOq1FMghwNSyVr+WmXxx+qgLorHewAxCjlT0=;
        b=hTB4Y1H/C7lhZTtoCCJBN/YBThOL+8nIzF8aYdz/n2/UO/HKd1+INl3XG47IFg/2v9
         kmsyfZkkMg6q2CZPUSpLj8AEWj9+Jzd4OUqlXwkeOk9pIK/flEg0psPYgD+fA8S5xObo
         jdgOrprztWkJKeMgOrOjb3ZEl3BaUHXQPsKv4PR+DImoNmTDs28FfJ6ykSwWmqmmY6hd
         L6JM15LZLiQ6xUTdHcmBnegWoNgWNL5tefojATbMp+eD9yWtSyRDWCYv5XdXRx8sIjg5
         fRwnxLgrTbLhrDu87Z7IeD3d9hTV0486zeqrD2HU9fcYcG3hC6z/grus4VrXu+DIcCTm
         dLfA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to;
        bh=bsyLzBZpOq1FMghwNSyVr+WmXxx+qgLorHewAxCjlT0=;
        b=RCibCmFHmYoXK5xtgCvVcuvcV7t67CgkwbeMHmMIEYGPjxoUh7S7uJvBSXL++vpP5R
         KdkFU3aEWW3tzxBnH2nZJ/2jsZf6qPKwhVis+SiCfqMTly4JAhTlKxP+ogRSBoHbB0wU
         g+N+7M8xj4yDzuJpNRuyhAmIT3CWVsjBUqvlw7R8jhMSjaXny2atppckB4JDI4TJQPov
         Ki0N3djLgnji6A7mIjhe1Rl+kRrCY2kHvTFJR6wDKw++KU/kozsgp99fa/s3zAnh0Uhe
         i5Bzs3wlbRcQOoSPS8DLdDprmVgfx5WqQ+VUY5U92zVxuKHnsDj1uxkSswcDiiCYFHFP
         72nw==
X-Gm-Message-State: APjAAAVZwyCBzCMoJXhFe8Cu85k0DVnmh8/iJynJ9hoblJd4iew7K3GO
	6xafWZmbr9W0FcR3lXU68YCQ7z50/pvj2TXivOuo7WDASo4=
X-Google-Smtp-Source: APXvYqz37JRutbtXmHHImt4wEWvlRdTmQXw7OCWMVnCkeBB17GFTTy0sidtozc0+Q+iodOCRElaKgd+Y5ZYVIdIeTow=
X-Received: by 2002:a24:9f47:: with SMTP id c68mr3040251ite.110.1553179179423;
 Thu, 21 Mar 2019 07:39:39 -0700 (PDT)
MIME-Version: 1.0
References: <CAF+90c-q631w16DahA9bZPWyZPtYMaA0yB+vvKLxKi3AApUQDg@mail.gmail.com>
In-Reply-To: <CAF+90c-q631w16DahA9bZPWyZPtYMaA0yB+vvKLxKi3AApUQDg@mail.gmail.com>
Date: Thu, 21 Mar 2019 15:39:23 +0100
Message-ID: <CAF+90c_pZvfDZJe-LuUvcHOppDFAPCnhxxzRbv1BufM0kLPzEg@mail.gmail.com>
To: PHP internals <internals@lists.php.net>
Content-Type: multipart/alternative; boundary="000000000000431b8105849bb5ad"
Subject: Re: Convert ext/xml to use an object instead of resource
From: nikita.ppv@gmail.com (Nikita Popov)

--000000000000431b8105849bb5ad
Content-Type: text/plain; charset="UTF-8"

On Tue, Feb 12, 2019 at 4:00 PM Nikita Popov <nikita.ppv@gmail.com> wrote:

> Hi internals,
>
> 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?
>
> Regards,
> Nikita
>

I'd like to move forward with this. Jakub requested this change to be
postponed to 8.0 in
https://github.com/php/php-src/pull/3526#issuecomment-469796632 to minimize
BC issues. As 8.0 is close I'm okay with just doing that, this is not super
urgent for me.

Is there anything else that needs to be resolved here, or is this good to
go for PHP 8.0?

Nikita

--000000000000431b8105849bb5ad--