[php-src] Issue #20855: Assertion failure in zend_hash_del with HashTable refcount inconsistency
| From: | vi3tL0u1s | Date: | Wed, 07 Jan 2026 02:56:37 +0000 |
| Subject: | [php-src] Issue #20855: Assertion failure in zend_hash_del with HashTable refcount inconsistency | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251493@lists.php.net to get a copy of this message | ||
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