Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117469 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65067 invoked from network); 31 Mar 2022 14:34:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 31 Mar 2022 14:34:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D56061804C6 for ; Thu, 31 Mar 2022 09:03:18 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8560 212.227.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 31 Mar 2022 09:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1648742596; bh=qjJjxO9MXuGe855z4pGRQ0VaMEWxOCqoUz7cZwmF2lM=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=WHF/mstgnxS4Nw7rJxIygZ5VI/mkG17iYb769p9bjKqIJ/YjlyUluoY/EaGz2fWzD 8GKTltGF9EsrCmd4kcdRliogkBeLsAzsT9Oa8cj/MBGAicwodN2B50Bzk0bcapmCuu JFehTjDVYZ/lSz3yTVCVhvtEIU8AhyYorxflVs3U= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.2.130] ([79.220.80.11]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MrhQC-1oL8St3l0G-00neSC; Thu, 31 Mar 2022 18:03:15 +0200 Message-ID: <0a1fa315-9716-5c4a-dcd0-8e8532fb86a7@gmx.de> Date: Thu, 31 Mar 2022 18:03:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: de-DE To: Ilija Tovilo , PHP internals References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:cbmC9ez9Rjlygz2ytIsEeaP/BS0ih/gGbIBarmKN/cLG57dQjZF /GA1SYDqBHPI93NztAdTD4Zi6+I6eXA2fTn1UOqdmJDXHiR5PhhlmIbXpKDErPRT+yfLV2e 4eRC7zw8FoItw5Y/D56YcxTiI+N5F7UMoIz09xhsvP816qVYR5VVFLhO9hOocjjxwPeoUT+ ws19XS+wmYDeF7aBnsEKQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:bs7eBXksCMI=:Q6a1/KPvCILw62eMJyvMQG MtO6hb7lzf+6l9G1fLHzfjm6u/SCKBbLR9TxH7zLQdVbxyxcXwCiPQ4e/c9cvTrhgrafb32or a6wlQgCtisxhdrsqi65fy0IMhszyJ7ytcLqzOLqZNBsqQPh7AzLFZzvCxskbFTY7kzUDIz7B2 eColBsjSkAbs3w11TMRgcBgfIkpLAE6qbNJdJj38PMyxXrbsDeRnxwnLJJolrwYJSt7CwpW0q PYuSiBhfNyXceFGSWk7y3u2DfNpFoI8D3iV0slM6RQJOYr7vwViZDS8kyN6A3M/fcY7TjM9lz D7OUZNVLAGzSQW8P7WXVRA10Qskm8BYXkVXVNDu+ojDkMxiZYmNSgQ0zdIq4u519gHyzQaK1a 52nUoE6XuQNC4piiJHuJ3fxlN4pvbTdyIGZqETI9/FjCx2OVzOD1eYOaQbUikW4Yb/vgRFVWR kdMbrXU7wkQjGw7xQ6B1HhwKzobbGqDEHtRAn0Qo9IKiYiI5ibqHlYAsigkBL/pSPfAASsDmm A037MQ9fw0CBXKqSsS8kJKYPyUcNmCJs1h5ULzEoHh78PMA/1h7n7ep/e6UYE0Wsh8yTpnWtJ 8MZYIcJ+tGJyFP9X+Ye7CBkZMQgAtHUWZuV+8mIDHtH1QDTcKhDmfBhKki2qwwEq8ZXqAY+qU otW594sacE0M5+rBg5lHA0w4i51GiERegflgGNW9ly4HKkmA7ujdHdxDihr+1CcZirpVcxIHE ZVHKLocxkQ0pZ87RDa0kwwrF6T3HEsDmbz43W9cczEgddUlFe+LRWZpWn1AXa5gCwr2D90gJj Ns1DFDqFoYA3/cYhW/7vLZN2SZWLShZrtbwSPPGTOBvM98Lpop2oyxh3plTOAWe6Zac09bKh4 q65Okt0i8VynKzlZs0RDdGeB65xOlVDJJfmdl6B8KQ3Kw+/Tkp+RSgb7wJB/5bjF1nVFOhU6z cLmO3eqdVqCoa6Mk/VZ3wZ4qIaC0QSyMLgueJ9Q9QWEqPpSxIoP+oJBqTn5YBHULAJQ4U2M/G WBcz2Gm9y7lVyLRq/VCvZB83VJax/3C9iEibeV2rlu+Lc31LBy6zkvlbqUUHXClwwGj7EB1FV PlEHL8qaYx73wo= Subject: Re: Add leading backslash to enum and class names in var_export From: cmbecker69@gmx.de ("Christoph M. Becker") On 31.03.2022 at 17:45, Ilija Tovilo wrote: > We've had two bug reports for var_export not working for enums. The > reason for that is that var_export does not add a leading backslash to > names of enums. This will cause them to be resolved as > `\CurrentNamespace\EnumNamespace\EnumName` instead of just > `\EnumNamespace\EnumName`. > > enum A { > case B; > } > > echo var_export(A::B, true), "\n"; >> A::B > > > This is a problem for things like Doctrines ProxyGenerator that embeds > the result of var_export in classes with namespaces > (https://github.com/doctrine/common/pull/955). The Doctrine team > resolved this by adding a `use` of the enum at the top of the file but > that really shouldn't be necessary. > > The same issue already exists for classes. > > class C {} > > echo var_export(new C(), true), "\n"; >> C::__set_state(array( >> )) > > https://bugs.php.net/bug.php?id=3D64554 > > Marco Pivetta created a PR that adds leading backslash to all class or > enum names of var_export. Adding a backslash will make the code work > both inside or outside namespaces. > https://github.com/php/php-src/pull/8233 > > To avoid disruption, I'm proposing to merge this into PHP 8.2 only. > Unless anybody has any objections to this change I will merge it in a > few weeks. It might be worthwhile to point out that this issue already came up years ago, and after some discussion[1] the idea was rejected back then. That said, I'm not against changing this now, but would not want to do that for any of the stable PHP versions. Targeting PHP 8.2 is fine for me= . [1] =2D- Christoph M. Becker