Re: [PHP-DEV] Escape \0 in var_dump() output

2021-05-28 Thread Nikita Popov
On Thu, May 27, 2021 at 6:11 PM Sara Golemon wrote: > 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 tes

Re: [PHP-DEV] Escape \0 in var_dump() output

2021-05-27 Thread Sara Golemon
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 out

Re: [PHP-DEV] Escape \0 in var_dump() output

2021-05-27 Thread Nikita Popov
On Thu, May 27, 2021 at 3:54 PM Sara Golemon wrote: > On Thu, May 27, 2021 at 8:42 AM Nikita Popov wrote: > >> The most prudent and BC-safe thing would be to add another function >>> `var_dump_escaped()` or even to prefer/advise json_encode() when content >>> safety is relevant, but additional t

Re: [PHP-DEV] Escape \0 in var_dump() output

2021-05-27 Thread Sara Golemon
On Thu, May 27, 2021 at 8:42 AM Nikita Popov wrote: > The most prudent and BC-safe thing would be to add another function >> `var_dump_escaped()` or even to prefer/advise json_encode() when content >> safety is relevant, but additional type information is not (most of the >> uses of var_dump we h

Re: [PHP-DEV] Escape \0 in var_dump() output

2021-05-27 Thread Nikita Popov
On Thu, May 27, 2021 at 3:22 PM Sara Golemon wrote: > On Thu, May 27, 2021 at 5:44 AM Nikita Popov wrote: > >> https://github.com/php/php-src/pull/7059 does a surgical change to >> replace >> null bytes with \0. >> >> > Before delving into any other observations, I first want to state > emphatic

Re: [PHP-DEV] Escape \0 in var_dump() output

2021-05-27 Thread Sara Golemon
On Thu, May 27, 2021 at 5:44 AM Nikita Popov wrote: > https://github.com/php/php-src/pull/7059 does a surgical change to replace > null bytes with \0. > > Before delving into any other observations, I first want to state emphatically that we should not ONLY escape chr(0). We either apply full on

Re: [PHP-DEV] Escape \0 in var_dump() output

2021-05-27 Thread Harm Smits
Hey, > whether var_dump() should be performing any escaping at all, and if yes Well, since var_dump is essentially for debugging purposes, it makes sense to escape certain characters. Like you mentioned, some IDEs do not print/support null bytes. Hence, I am all for it, as it simplifies debugging

[PHP-DEV] Escape \0 in var_dump() output

2021-05-27 Thread Nikita Popov
Hi internals, A regular annoyance with our test suite is that var_dump() prints null bytes literally, those null bytes get into our test expectations, the test is interpreted as a binary file by git, and diffs will not be shown on GitHub. Of course, the null bytes are also confusing to the reader