is_readable() not working on files inside phar
未关闭
还没有人认领这个 Issue。
Bug
Extension: phar
Status: Verified
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
Using the following code to create a basic phar file:
$stub = <<<STUB
<?php
Phar::interceptFileFuncs();
set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path());
include "index.php";
__HALT_COMPILER();
STUB;
$index = <<<INDEX
<?php
var_dump(file_exists('phar:///path/to/archive.phar/index.php')) . PHP_EOL;
var_dump(is_readable('phar:///path/to/archive.phar/index.php')) . PHP_EOL;
var_dump(file_exists('index.php')) . PHP_EOL;
var_dump(is_readable('index.php')) . PHP_EOL;
INDEX;
$phar = new Phar('archive.phar');
$phar->addFromString('index.php', $index);
$phar->setStub($stub);
Then executing the following code:
php archive.phar
Resulted in this output:
bool(true)
bool(false)
bool(true)
bool(false)
But I expected this output instead:
bool(true)
bool(true)
bool(true)
bool(true)
Or executing the following code:
<?php
var_dump(is_readable('phar:///path/to/archive.phar/index.php'));
Resulted in this output:
bool(false)
But I expected this output instead:
bool(true)
PHP Version
PHP 8.0.12
Operating System
Ubuntu 20.04
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
在 PHP 8.0.12 上使用提供的 archive.phar、index.php 和 Phar stub 重现该行为。首先跟踪 Phar::interceptFileFuncs() 和 is_readable() 路径,然后添加或更新回归测试,以显示 Phar 内的文件报告了预期的可读状态。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100