Skip to content

Assertion failure in zend_hash_del with HashTable refcount inconsistency #20855

@vi3tL0u1s

Description

@vi3tL0u1s

Description

The following code:

<?php
$c = new ReflectionClass('stdClass');
ob_start(fn() => serialize($GLOBALS), 1);
$array = [$c];
unset($array[$x]);
php: /path/to/php-src/Zend/zend_hash.c:1556: zend_hash_del: Assertion `(zend_gc_refcount(&(ht)->gc) == 1) || ((ht)->u.flags & (1<<6))' failed.
Aborted

Commit

5472cac806a

Configurations

CC="clang" CXX="clang++" CFLAGS="-fsanitize=address -g -O0" CXXFLAGS="-fsanitize=address -g -O0" ./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic

PHP Version

PHP 8.6.0-dev (cli) (built: Jan  7 2026 13:33:43) (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