Assertion failure with ext/date DateInterval property hash construction
未关闭
还没有人认领这个 Issue。
Bug
Extension: date
Status: Verified
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
The following code:
<?
for ($i = 0; $i <= 2; $j++) {
$a[] = $$x[ ! 0] = $obj = new DateInterval('P1W');
$a = false;
$aniay['abc'] = $obj->prop3 = $y = (array) $a[] =& $ $u;
$$x[$key]-= $aniay['abc'] = $a === $ao = new ArrayObject();
var_dump(json_decode(json_encode($a), '1000001'));
}
Resulted in this output:
php: /path/to/php-src/Zend/zend_hash.c:912: _zend_hash_str_add_or_update_i: Assertion `(zend_gc_refcount(&(ht)->gc) == 1) || ((ht)->u.flags & (1<<6))' failed.
Aborted
Commit:
035f95cf5e016236cca11bc293dc04d40b40e45c
Build configuration:
CC="clang" CXX="clang++" CFLAGS="-fsanitize=address -g -O0" CXXFLAGS="-fsanitize=address -g -O0" LDFLAGS="-fsanitize=address" ./buildconf --force && ./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic --enable-mbstring --with-zlib
PHP Version
PHP 8.6.0-dev (cli) (built: Nov 16 2025 19:51:33) (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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用提供的 debug 和 AddressSanitizer 配置构建 commit 035f95cf5e016236cca11bc293dc04d40b40e45c 中的 PHP,然后运行 reproducer。检查 Zend/zend_hash.c:912 处的断言以及 ext/date 中 DateInterval 的行为;完成的标准是 reproducer 不再 abort,并且该失败有回归覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, php
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100