Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117466 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 60224 invoked from network); 31 Mar 2022 14:16:57 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 31 Mar 2022 14:16:57 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 35040180505 for ; Thu, 31 Mar 2022 08:45:41 -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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) (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 08:45:40 -0700 (PDT) Received: by mail-il1-f170.google.com with SMTP id t15so39638ilq.12 for ; Thu, 31 Mar 2022 08:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=aN64UJgi5quflOqx7D6XZyDatMfe4fj1fa6gr7KkSCw=; b=fYU+ceTtLVmS4riGWNVuBmXXMgpkMAv80Y/hXWtM5WFwSPTpiKcRLhltMwO6xWRTAE sXl0VhI7+C4tnhh6BJNQedm0e9+sec3if7HhmTOI4mPZZr8Bv5phKyVMBhxowlPUjayd pKYwV3fpou6a1jJRpG5dM7/7cxdWTN33WZfUuLHjFY97fQ22xyY4lTR1OAYXgIXk13pl AqWfUko9NqlWcy7ZvoCNJhHyHYPDJX9MdbiD8SYltHYu1ljw7RVS+MDp2ZRF+/8YHNgP RAj+K3a/UpnKnBRZAhplWBVy0aMgUPTny5tUJlwUSIb1lLyqHVtNizCnU58WapGNVh/5 54KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=aN64UJgi5quflOqx7D6XZyDatMfe4fj1fa6gr7KkSCw=; b=K8C4LIvv+E1bCaTCceoRNTfry08iN6VfYX4dpN433NPy9y0O+R6kCos3j5WWIvLk2V D8rbxkQlFtqdyC6J1aqLN85+9twc+XN8ZQXJ1ayHiNt79e6jSfW42VycN/B4zow1bCI/ s+QeTWGJlraP9dbWmAoGbtgIVtth5yFmvm5lWxIqPKQtRh4htVhZnPi21GJxB17qHUnY lYJJ5wnL5wxKk1z77iEwIGdv2eVE8tgBDhUdeualM7F2fnlNthlnELAL2miAjHvLwoHg JFZEhcxA1sXpcNGSPQoe6nfYYbNPZ1oOom8dWOB3cmen+ZjOsKknF/BmAGiFGvaIQFFW V75w== X-Gm-Message-State: AOAM533PThFQhDleEQq4ilE7W7cwwkDAu/RJNkUIcamUoMN53BD+oT3G vYNdyKR/a2bNTbyG8RE2p2Aojd2RLirF/C+ViVPVNnqwaxE= X-Google-Smtp-Source: ABdhPJxaF5OHZxH/Xxr4iOIeQNo5kQBSjZ9E6oZS4YNyATEYgoLDao1SoIM9HA4d6mCMVeVsr3VXBJ/qWBdGZqYHrng= X-Received: by 2002:a05:6e02:148a:b0:2c9:a0b2:b14 with SMTP id n10-20020a056e02148a00b002c9a0b20b14mr12343560ilk.259.1648741539757; Thu, 31 Mar 2022 08:45:39 -0700 (PDT) MIME-Version: 1.0 Date: Thu, 31 Mar 2022 17:45:29 +0200 Message-ID: To: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Add leading backslash to enum and class names in var_export From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi everyone 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=64554 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. Ilija