Assertion failure at Zend/zend_hash.c:3076
Open
Nobody has claimed this yet.
Bug
Extension: standard
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
set_error_handler(function() {
$GLOBALS['x'] = $GLOBALS['y'];
});
function x(&$s) {
$s[0] = 1;
};
x($y);
arsort($y, $fusion);
Resulted in this output:
/php-src/Zend/zend_hash.c:3076: void zend_array_sort_ex(HashTable *, sort_func_t, bucket_compare_func_t, _Bool): Assertion `(zend_gc_refcount(&(ht)->gc) == 1) || ((ht)->u.flags & (1<<6))' failed.
Aborted (core dumped)
PHP Version
nightly
Operating System
ubuntu 22.04
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided PHP snippet on the nightly build, then inspect the assertion at Zend/zend_hash.c:3076 and the arsort path it reports. Done means the reproducer no longer aborts with the zend_array_sort_ex assertion and its behavior is covered by an appropriate 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
- Mostly clear
- Newbie friendliness
- 42/100