[php-src] Issue #20906: Assertion failure in zif_highlight_string when called in destructor
[email protected] (vi3tL0u1s)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/20906
Author: vi3tL0u1s
### Description
The following code:
```php
<?php
class A {
function __destruct() {
highlight_string("<?php", true);
trigger_error("");
ob_start(function () use (&$c) { $c = new A; return '/'; }, 1);
$c = new A;
unset($c);
ob_start(function &() use (&$c) { $c = new A; return '/'; }, 1);
}
}
new A;
```
Resulted in this output:
```
/php: /path/to/php-src/ext/standard/basic_functions.c:1837: zif_highlight_string: Assertion `zval_get_type(&(*(return_value))) == 6' failed.
Aborted
```
## Commit
`2813f62476f6fb1b8d59f25527dbf2953fdf69a7`
## Configurations
```
./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic --enable-mbstring --with-zlib
```
### PHP Version
```plain
PHP 8.6.0-dev (cli) (built: Jan 11 2026 13:54:51) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.6.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.6.0-dev, Copyright (c), by Zend Technologies
```
### Operating System
Ubuntu 22.04