Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113213 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 98567 invoked from network); 19 Feb 2021 15:34:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Feb 2021 15:34:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D557A1804B1 for ; Fri, 19 Feb 2021 07:22:00 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: *** X-Spam-Status: No, score=3.2 required=5.0 tests=BAYES_40, 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-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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, 19 Feb 2021 07:22:00 -0800 (PST) Received: by mail-lj1-f179.google.com with SMTP id a22so22263331ljp.10 for ; Fri, 19 Feb 2021 07:22:00 -0800 (PST) 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=kdZDaGHwz4+SvqEr2Zu93aiw1hKCUQReLt57NVeURdk=; b=S4J78lYTt9hpISQ9AQH3+pN1esq3UMDD+17Ioc14vH6WVudjs0xEBtglZ+SX8orIly CZgGJ99neKXRxiVSGFqJuWD+z3NkQJSD94ySjifZYRsk/a1048XWw/W+LFxnaQlSyid7 9L8XDE0cK5jr84vW2h81MIomov7TIp0G/EloS+51hmWBSEkLH3Y4VQ9VUcwcRbE/OR2U HfOncBilnFNKgqptcYvRqtWMNxwguqsbbd7TGUD3EEbOP8TGrUbWKy9nrUq/ikpdEBLw LAEfsnply5Pl6ypebeAvy6QwRlDBBClGnVvGg6Nnwd8bhV6IskL3ss7unZP3RaI9xxxf drfw== X-Gm-Message-State: AOAM531Qe/sv9zC6iEjqNmIH2aacLyEKhnIOl/BLJwIUC5tzZAovdLwW iyv9QT0St4lO4WMJaDew9a3HRDWpbkI9ixGo+4pHnSMgzDgorgNd X-Google-Smtp-Source: ABdhPJx+1w6/4C9D4q9pJvCbWGfXjySdvJvn4fJWUGAvYcX1p7/TaJLJYMm9FI6pu7t944aAYtACaXiWWoh3VC0UHLg= X-Received: by 2002:a19:654f:: with SMTP id c15mr5695230lfj.397.1613748115527; Fri, 19 Feb 2021 07:21:55 -0800 (PST) MIME-Version: 1.0 References: <52E47CD0-11F0-45DF-9387-DFB5DFDC481A@cschneid.com> In-Reply-To: <52E47CD0-11F0-45DF-9387-DFB5DFDC481A@cschneid.com> Date: Fri, 19 Feb 2021 09:21:44 -0600 Message-ID: To: Christian Schneider Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000002eeba505bbb20357" Subject: Re: [PHP-DEV] Small annoyances of PHP: Simple fixes would make tests fail From: pollita@php.net (Sara Golemon) --0000000000002eeba505bbb20357 Content-Type: text/plain; charset="UTF-8" On Fri, Feb 19, 2021 at 8:04 AM Christian Schneider wrote: > Hi there, > we encountered small annoyances over time which could be easy to fix but > would break tests. > Why does this matter? While it is easy to fix the PHP test suite they > could potentially affect other projects' code, most probably tests. > > Here are the two things on our current list: > > Stack traces: > ========== > Stack traces for certain constructs do not include the exact location in > the stack frame: > $a[(object)null] = 1; > $e->getTrace() => [] # <-- no stack trace > while for > file(); / file(null); > $e->getTrace() => [ ["file"]=> .. ]. > > What version are you testing with. I know Niki killed some unnecessary frames in 8.0's stacktrace output. (A whole repro script is more useful than a snippet wherein $e comes into being seemingly from nowhere). > Indentation in var_export: > ==================== > The indentation for > var_export((object)[(object)[]]); > is off by one for nested structures: > (object) array( > '0' => # <-- extra space before index > (object) array( > and the fix would be to change > buffer_append_spaces(buf, level + 2) > to > buffer_append_spaces(buf, level + 1) > in ext/standard/var.c > > This breaks about 60 PHP tests relying on the var_export format. > > I think shifting the indentation in var_export() could probably be done without a major BC break. Trimming trailing whitespace would also resolve one of my long-time annoyances with the function. Feel free to propose that as a PR and/or an RFC. -Sara --0000000000002eeba505bbb20357--