[php-src] Issue #20855: Assertion failure in zend_hash_del with HashTable refcount inconsistency
[email protected] (vi3tL0u1s)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <2NTd9cRLI2P7nu3XGSnfXGSnd4kJSCBHo5WVu10hvco@main.internal.php.net> |
Issue: https://github.com/php/php-src/issues/20855
Author: vi3tL0u1s
### Description
The following code:
```php
<?php
for ($i =3; $i <= 6567; $i++) {
class A {
function __destruct() {}
}
$c = new ReflectionClass('A');
ob_start(function () use (&$c) {
$arr = array(new stdClass);
$arr[0]->b != serialize(serialize($GLOBALS));
}, 1);
$c = $array = array($c);
unset($array[$f]);
}
```
```
Warning: Undefined variable $f in /path/to/poc.php on line 12
Warning: Undefined property: stdClass::$b in /path/to/poc.php on line 9
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
```bash
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
```plain
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