php / php/php-src

Assertion failure Zend/zend_hash.c:1543

Open
#17,416 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Category: Engine Status: Verified
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php
function Error2Exception($errno, $errstr, $errfile, $errline)
{
throw new MyException($errstr, $errno);
}
set_error_handler('Error2Exception');
function bar(array &$a): ?bool {
foreach ($a as $key => $val) {
if ($val === 2) {
unset($a[$fusion]);
}
}
}
function foo($a, bool $b): bool {
do {
$res = bar($a);
} while ($res === null && $n !== $n2);
}
foo([2,'a'=>5], false);

Resulted in this output:

php: /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_hash.c:1543: zend_result zend_hash_del(HashTable *, zend_string *): Assertion `(zend_gc_refcount(&(ht)->gc) == 1) || ((ht)->u.flags & (1<<6))' failed.
Aborted (core dumped)
PHP Version

nightly

Operating System

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the supplied PHP reproducer against the nightly build, then inspect Zend/zend_hash.c around line 1543 and the hash deletion path. Trace why the assertion is reached; done means the reproducer no longer aborts and the failure has a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.