Gzip output handler - `ob_end_flush()` must not call `flush()`
还没有人认领这个 Issue。
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
This issue is problematic only when zlib.output_compression is enabled.
Currently, when zlib.output_compression is enabled like:
php -S 127.0.0.1:81 -d zlib.output_compression=1 -t .
(but also tested if enabled when used /w Apache /wo mod_deflate)
and ob_end_flush() is called, no headers cannot be send anymore even if the nothing was output.
Currently, we had to use the following code
while (ob_get_level() > 0) {
if (ob_get_length() === 0) {
ob_end_clean();
} else {
ob_end_flush();
}
}
to workaround.
When zlib.output_compression is NOT enabled, the following code:
while (ob_get_level() > 0) {
ob_end_flush();
}
is working (allows to send additional headers).
Because of this inconsistency, I belive php gzip output handler behaviour should be fixed, when output buffer is empty, to not flush implicitly.
PHP Version
any
Operating System
any
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用提供的 PHP CLI 命令重现该行为,将空输出缓冲区与包含输出的缓冲区进行比较,并检查是否仍然可以发送 headers。然后检查 ob_end_flush() 路径和 zlib 输出处理程序;当空缓冲区不会隐式执行 flush,而非空输出仍保持预期行为时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, php
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100