php / php/php-src

is_readable() not working on files inside phar

オープン
#7,976 コメント 14 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Extension: phar Status: Verified
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

提供された archive.phar、index.php、および Phar stub を PHP 8.0.12 上で使用して動作を再現します。まず Phar::interceptFileFuncs() と is_readable() のパスを追跡し、次に Phar 内のファイルが期待される読み取り可能状態を報告することを示す回帰テストを追加または更新します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。