Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114655 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96871 invoked from network); 28 May 2021 12:28:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 May 2021 12:28:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A51D41804CC for ; Fri, 28 May 2021 05:40:27 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 ; Fri, 28 May 2021 05:40:27 -0700 (PDT) Received: by mail-lf1-f51.google.com with SMTP id b18so1012004lfv.11 for ; Fri, 28 May 2021 05:40:27 -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 :cc; bh=w8SIYwElKDhTVxyjUKOONS6JiHe01cfqSOVIarZlN1s=; b=kvawr5ONYI5b2C9E64Xcbd9/ALfI5OhOCl91pYV8S5iG7OolobIvFKfjNsVV8WsbKo H7KwX1RMSDtRJA6S9dD2iWUx1ZkTXjNaup1ubvyNz60bZQq8+aWGOLsHAKDjGHtvtrZX Lvv28CWUcZPcJuH8ZjR5AIomi4S102LIh4dTfKlzsfd0Ctk/jk6HCmtQoSk+PSPyNFbd bSmzo0+rcbBncv8w90tZSnF/HKA4RHdyBbYHIMc73JCXoKEzmpB9Lj5ZDq3FjjlEDwuS d5DISq2ADCM0jA4CTikmpXg5GqRRAAmbSL6fzgY1QdG8Fz+BunPiMUF8mMhie8TKNfLb KECw== 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:cc; bh=w8SIYwElKDhTVxyjUKOONS6JiHe01cfqSOVIarZlN1s=; b=bFRlITqbFcG90CCDkMArKpEuBBbND40OSP84hbn9IvL7L2VZkaQe88QZYhmnI+hVVp 3Z/C8PyGX4TKKGxaQ0o+PZyPbqi6vlB5jdtXWpsAIvK+d0jQRkL859GIHLWXpOGtxcOi 9DeCCcyzlkjkdp34+lJIfjQjsT15t4Pw8HPOP5Zu0mxGUHYTHO8gtIVaA8V8uT1iBeGy axN6SJEFQ+DgUai5aDPHfuVxWVvuy6gIh+vbdD/g57ucTSUp+cCiOneRmc5qg3uBPeIg ill2k13lCdwqHmiXayWFK1dQq30eaHBxmrfeepgwvkXJRGm7gsP3e7pzVpe75OX0dFdU wkPA== X-Gm-Message-State: AOAM5303cQZIf1A5tsWopBFeL9KC0yvPpv61XZKOtOkV76vXs2PokNUe CMeEQe8c4myNrTNJcTPcfkm+FORVYgXRCyh6fHfrCagnn+vzIg== X-Google-Smtp-Source: ABdhPJzQu4hBZFkc4NJU2O3lhIXsNf6bMQOhCtd28q+nSl4YYcGhpXkHpl6tkobv02jj6Nd6DhH1c1GruKP2AotBeTA= X-Received: by 2002:a05:6512:3e12:: with SMTP id i18mr826447lfv.286.1622205625424; Fri, 28 May 2021 05:40:25 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 28 May 2021 14:40:09 +0200 Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000000e5f4a05c3632ef7" Subject: Re: [PHP-DEV] Escape \0 in var_dump() output From: nikita.ppv@gmail.com (Nikita Popov) --0000000000000e5f4a05c3632ef7 Content-Type: text/plain; charset="UTF-8" On Thu, May 27, 2021 at 6:11 PM Sara Golemon wrote: > On Thu, May 27, 2021 at 9:07 AM Nikita Popov wrote: > >> Ah, I think I explained the original issue badly: The test runner output >> isn't really a problem, or at least I never perceived it to be. >> >> The problem is that if you change a test that contains a null byte >> anywhere (read: in var_dump output), then github will not show a diff for >> that file. You can see this nicely in the proposed PR itself: >> https://github.com/php/php-src/pull/7059/files Most of the updated test >> files show up as "Binary file not shown." As you can imagine, this makes >> review hard. Using the .patch file doesn't help either, because it only >> contains entries like: >> >> > AH! Yeah, I completely misunderstood the problem space. I didn't imagine > for a second we had non-ASCII in any test because that's bad and it should > feel bad. > > Okay, then I still disagree with changing var_dump()'s output, but for > different reasons. > > So take Zend/tests/bug60569.phpt for example, which has this EXPECT > section (where ^@ is actually the null byte): > > --EXPECT-- > string(20) "Some error ^@ message" > > Instead of changing how var_dump() works in order to produce different > output, I'd change the EXPECT to and EXPECTF and add a new %0 pattern > > --EXPECTF-- > string(20) "Some error %0 message" > > This creates zero BC breaks, allows extensions to continue working just > fine with raw nulls or update to use %0 if they'd like, and creates no > ambiguities. > I like that approach. Implemented in https://github.com/php/php-src/pull/7069. Regards, Nikita --0000000000000e5f4a05c3632ef7--