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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php