[php-src] Issue #22290: `assert()` failure errors do not correctly handle ASTs with strings containing NUL
| From: | TimWolla | Date: | Sat, 13 Jun 2026 12:22:26 +0000 |
| Subject: | [php-src] Issue #22290: `assert()` failure errors do not correctly handle ASTs with strings containing NUL | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252190@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/22290
Author: TimWolla
### Description
The following code:
```php
<?php
try {
$string = "Foo\x00bar";
assert(!str_contains($string, "\x00"));
} catch (Error $e) {
echo $e->getMessage(), PHP_EOL;
}
```
Resulted in this output:
```
assert(!str_contains($string, '
```
But I expected this output instead: The closing
')); should not be cut off.
Ideally the NUL byte would be output in escaped form.
### PHP Version
```plain
PHP 8.6.0-dev (cli) (built: Jun 13 2026 14:01:23) (NTS DEBUG)
Copyright © The PHP Group and Contributors
Zend Engine v4.6.0-dev, Copyright © Zend by Perforce
with Zend OPcache v8.6.0-dev, Copyright ©, by Zend by Perforce
```
### Operating System
_No response_