Skip to content

Assertion failure in zif_highlight_string when messing up output buffers #20906

@vi3tL0u1s

Description

@vi3tL0u1s

Description

The following code:

<?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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions