Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114647 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 18087 invoked from network); 27 May 2021 15:59:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 May 2021 15:59:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 15F981804D9 for ; Thu, 27 May 2021 09:11:14 -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=1.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL 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 ; Thu, 27 May 2021 09:11:13 -0700 (PDT) Received: by mail-lf1-f51.google.com with SMTP id j10so836391lfb.12 for ; Thu, 27 May 2021 09:11:13 -0700 (PDT) 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=uvMpi4OqtPNdVaHwP1QLK7FWPMFH5ZibJzK0u7yJKI4=; b=UUc/sHfVwbA8GAitjoVQSDDg1vwGM/WDuX92ZCzyLWMrYWj+9mBUYKeQyiSh7w+iXU SN01/YrytiSs0Ty+CNlwBfpqi0OSP9em7u2RY/OnrHrU2UYISX0MXrl1EF6Ex7a3CzDk SCFiAAq+KrYgZpmo2sOHRI1yju2frRIBem5/azVia25ROQIeDMganuhWqLXCs2zAdZP4 QacajeGy3TrdWdnq4opDQ4b70ekjRUQfsMHW40zPPK6kcZP3E3t0xbO1+N+ZwN/uS91Y j8A4HH3hW2FqMCd1RxsmYFqdj+yZiDZAKdkbet3szuAxmtZWz9eCJfaiZ22N7j8ITT4f /ZLA== X-Gm-Message-State: AOAM533BbT5nQd0suJWNJr+vFAF3Y2sKI6S7BkHG/X2QHAxHW8YnfP/3 Eo78iKv2XgAIPxi4CIoB6neo8jPtqOOKsrjsWikWnw== X-Google-Smtp-Source: ABdhPJxS432lrVQvPoVTp/PK6qDgE2fB07Qy5k9FpqnaxiWjDu22z9vHETLOmGOpiYjesM3nVygDpO2xcuZSSR98tSs= X-Received: by 2002:a05:6512:234b:: with SMTP id p11mr2924659lfu.102.1622131871986; Thu, 27 May 2021 09:11:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 27 May 2021 11:11:01 -0500 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000024a1405c35202eb" Subject: Re: [PHP-DEV] Escape \0 in var_dump() output From: pollita@php.net (Sara Golemon) --000000000000024a1405c35202eb Content-Type: text/plain; charset="UTF-8" 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. -Sara --000000000000024a1405c35202eb--