[php-src] Issue #9622: Special charactersBroken string representation of
| From: | nicolas-grekas | Date: | Tue, 27 Sep 2022 17:37:56 +0000 |
| Subject: | [php-src] Issue #9622: Special charactersBroken string representation of | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242470@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9622
Author: nicolas-grekas
### Description
Issue demoed at https://3v4l.org/bMiN9#v8.1.10
The following code:
```php
function f($b = ["\n", new \stdClass])
{
}
var_dump((string) (new ReflectionFunction("f"))->getParameters()[0]);
function g($b = ["\n"])
{
}
var_dump((string) (new ReflectionFunction('g'))->getParameters()[0]);
```
Resulted in this output:
```
string(55) "Parameter #0 [ <optional> $b = ['
', new \stdClass()] ]"
string(39) "Parameter #0 [ <optional> $b = ['\n'] ]"
```
But I expected this output instead:
```
string(55) "Parameter #0 [ <optional> $b = ['
', new \stdClass()] ]"
string(39) "Parameter #0 [ <optional> $b = ['
'] ]"
```
### PHP Version
PHP 8.1+
### Operating System
_No response_