Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108748 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31789 invoked from network); 25 Feb 2020 00:45:58 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 25 Feb 2020 00:45:58 -0000 To: internals@lists.php.net References: Date: Tue, 25 Feb 2020 00:03:14 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 46.59.72.204 Subject: Re: Make var_dump() use serialize_precision From: ajf@ajf.me (Andrea Faulds) Message-ID: Nikita Popov wrote: > Hi internals, > > https://github.com/php/php-src/pull/5172 changes var_dump() to use > serialize_precision instead of precision to dump floating-point numbers. Hi Nikita, Thank you so much for doing this! I had wanted to do this for a long time, and I actually implemented it and began updating tests a while ago, but I never got round to finishing it. It looks in that PR like you also update debug_zval_dump(), maybe that should be mentioned? The one that gave me pause before and now is print_r(). In principle, it is just `print` but recursive (I assume that's whence the name comes), but unfortunately some people use it for debugging, so there might be a case for changing it. With that said, it's already a very bad choice for debugging due to other things ("1", 1, 1.0 and TRUE look the same, "0", 0.0, and 0 look the same, "", FALSE and NULL look the same…) that precision is the least of the developer's problems if they choose print_r(), and it's also not in the spirit of "print but recursive". So, it is probably unreasonable to change print_r() here. Maybe we should put a massive red "DO NOT USE THIS FOR DEBUGGING" warning on its documentation page… One more thing, does var_export() use serialize_precision already? I think it does but haven't checked. Thanks! Andrea