bzip2.decompress stream wrapper truncates valid bz2 files from pbzip2
维护者通常 1 天内回复
评估
调研方向
Start by comparing the compress.bzip2:// wrapper path with the bzip2.decompress stream filter, using the provided PHP example as a reproducer. Trace where concatenated-stream handling differs and add a regression test for the wrapper with two concatenated bz2 streams; done means both reads return 900004 bytes without truncation.
由索引模型根据 Issue 内容生成。
描述
Description
pbzip2 slices a file into 900000 byte blocks and then concatenates the streams. The default PHP behavior for using libbzip2 stops after the first concatenated stream without warning. This results in silently truncated reads.
The following code:
<?php
$f = tempnam(sys_get_temp_dir(), 'bz');
file_put_contents($f, bzcompress(str_repeat('a', 900000)) . bzcompress('tail')); // two streams
echo strlen(file_get_contents("compress.bzip2://$f")), "\n"; // 900000 if truncated, 900004 if not
$fp = fopen($f, 'rb');
stream_filter_append($fp, 'bzip2.decompress', STREAM_FILTER_READ, ['concatenated' => true]);
echo strlen(stream_get_contents($fp)), "\n"; // 900004
Resulted in this output:
900000
900004
But I expected this output instead:
900004
900004
PHP Version
PHP 8.5.11 (cli) (built: Sep 24 2026 14:38:36) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.5.11, Copyright (c) Zend Technologies
with Zend OPcache v8.5.11, Copyright (c), by Zend Technologies
Operating System
Debian 12.15
- 主要语言
- C
- 星标
- 40.7k
- 派生
- 8.3k
- 平均合并
- 2 天 20 小时
- 30 天内合并 PR
- 147
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php/php-src 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
sapi/fpm/tests/tester.inc can send SIGUSR2 to pid 0, killing run-tests.php可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
zend_set_local_var() overwrites existing compiled variable (CV) zval without calling zval_ptr_dtor()可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
Case-insensitive substr_compare, ksort, krsort are still locale-dependent可能已有人在做 @lazerg 于 4 天前认领。 未关闭Bug Extension: standard Status: Verified
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
相似的 Issue
-
dependency component: oneMKL module: dpclang
难度 2/5 1-3 小时 新手友好度 82/100
intel/torch-xpu-ops#5880 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
CVE-2026-111497未关闭
难度 1/5 1 小时以内 新手友好度 82/100
fink/fink-distributions#1322 ·
-
难度 1/5 1 小时以内 新手友好度 83/100
openvehicles/Open-Vehicle-Monitoring-System-3#1563 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100