php-src icon indicating copy to clipboard operation
php-src copied to clipboard

Should \is_file support phar://some.phar?

Open brambaud opened this issue 4 years ago • 1 comments

Description

Hello!

I'm not sure if it is a bug or the expected behavior 🤔

The following code:

<?php

$path = 'phar://'.__DIR__.'/some.phar';

\var_dump(
    \file_exists($path),
    \is_file($path),
);

Resulted in this output:

bool(true)
bool(false)

But I expected this output instead:

bool(true)
bool(true)

I know that realpath does not work with virtual path like Phar and I wonder if it is the same for is_file? 🤔 If yes then don't hesitate to close the issue and I will open a PR to document it if that's ok with you 😃 I don't think it is the same since \is_file('phar://'.__DIR__.'/some.phar/file.php') works and the documentation mention it works with phar:// wrapper (at least how I understand it).

PHP Version

8.1.0

Operating System

macOS 12.2

brambaud avatar Feb 12 '22 14:02 brambaud

Sorry for the noise I did not think enough before opening the issue! 🤦

Inside the phar 'phar://'.__DIR__.'/some.phar' is considered a directory 🤦 🤦

brambaud avatar Feb 12 '22 15:02 brambaud