[php-src] PR #15730: Enhance `zend_dump_op_array` to Properly Represent Non-Printable Characters (GH-15680)
| From: | WangYihang | Date: | Tue, 03 Sep 2024 18:11:57 +0000 |
| Subject: | [php-src] PR #15730: Enhance `zend_dump_op_array` to Properly Represent Non-Printable Characters (GH-15680) | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-28378@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/15730
Author: WangYihang
This pull request addresses issue GH-15680 which proposed an enhancement for
zend_dump_op_array to properly represent non-printable characters in strings.
This is useful for debugging purposes, as it allows developers to see the actual content of strings
that contain non-printable characters.
I have also added testcases for this change, and all tests related to this pull request were
**passed**.
For example, for the following php code:
```php
<?php
fwrite($buffer, "\x00\x01\xff--\n");
```
Current Output:
```c
0040 INIT_FCALL 2 112 string("fwrite")
0041 SEND_VAR CV6($buffer) 1
0042 SEND_VAL string("--
") 2 <------ new line (\n) is directly printed
0043 DO_ICALL
Expected Output:
```
With this change, the output might look like:
```c
0040 INIT_FCALL 2 112 string("fwrite")
0041 SEND_VAR CV6($buffer) 1
0042 SEND_VAL string("\x00\x01\xff--\n") 2 <------ properly escaped with
readable representations
0043 DO_ICALL
```
Related Issues/Pull requests:
+ https://github.com/php/php-src/issues/15680
+ https://github.com/php/php-src/pull/11337
+ https://github.com/php/php-src/issues/10576