Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113212 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91504 invoked from network); 19 Feb 2021 14:16:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Feb 2021 14:16:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9023B1804B1 for ; Fri, 19 Feb 2021 06:04:08 -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=0.0 required=5.0 tests=BAYES_20,HTML_MESSAGE, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from darkcity.gna.ch (darkcity.gna.ch [195.49.47.11]) (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 06:04:07 -0800 (PST) Received: from wafer-1.home (unknown [IPv6:2a02:1205:5053:a220:d913:bad0:4a3d:92f5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 5B3F31514A3D for ; Fri, 19 Feb 2021 15:04:05 +0100 (CET) Content-Type: multipart/alternative; boundary="Apple-Mail=_CC1BA4F3-EAAD-4C96-BD45-7109ED05A236" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Message-ID: <52E47CD0-11F0-45DF-9387-DFB5DFDC481A@cschneid.com> Date: Fri, 19 Feb 2021 15:04:04 +0100 To: PHP internals X-Mailer: Apple Mail (2.3654.60.0.2.21) Subject: Small annoyances of PHP: Simple fixes would make tests fail From: cschneid@cschneid.com (Christian Schneider) --Apple-Mail=_CC1BA4F3-EAAD-4C96-BD45-7109ED05A236 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Stack traces for certain constructs do not include the exact location in = the stack frame: $a[(object)null] =3D 1; $e->getTrace() =3D> [] # <-- no stack trace while for file(); / file(null); $e->getTrace() =3D> [ ["file"]=3D> .. ]. The change would probably be something like removing one line ptr =3D ptr->prev_execute_data; In Zend/zend_builtin_functions.c The BC impact Is that stack traces may contain an additional entry which = is used in a lot of tests. Work-around: Our solution right now is to manually check in the = exception handler whether $e->getFile() / $e->getLine() is already = contained in $e->getTrace()[0] and otherwise add it to have uniform = stack traces. Works, but ugly :-) Indentation in var_export: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The indentation for var_export((object)[(object)[]]); is off by one for nested structures: (object) array( '0' =3D> # <-- 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. We were hoping for a new function mitigating this issue but = https://wiki.php.net/rfc/readable_var_representation = seems to get = rejected so the issue remains :-) --- Is there any way something like there things could/should be tackled for = a future PHP version? I'm torn because of the impact vs. benefit of the improvements. - Chris --Apple-Mail=_CC1BA4F3-EAAD-4C96-BD45-7109ED05A236--