Bug #71616 [Opn->Nab]: realpath and DirectoryIterator::getRealPath not work in phar pack file

From: Date: Tue, 22 Jun 2021 14:16:19 +0000
Subject: Bug #71616 [Opn->Nab]: realpath and DirectoryIterator::getRealPath not work in phar pack file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234587@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71616&edit=1 ID: 71616 Updated by: cmb@php.net Reported by: janpoem at gmail dot com Summary: realpath and DirectoryIterator::getRealPath not work in phar pack file -Status: Open +Status: Not a bug Type: Bug Package: Filesystem function related Operating System: Windows 10 PHP Version: 7.0.3 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2016-02-17 09:27:37] janpoem at gmail dot com Description: ------------ This is a very strange question. It looks realpath returns false, but it's not. This happens in the phar file. Test script: --------------- <?php /** * realpath not work in phar pack file */ $paths = [ 'phar://phar_test.phar/hello', 'phar://phar_test.phar/hello/a.php', ]; function let_it_work(string $path) { $realPath = realpath($path); if ($realPath !== false) { $path = $realPath; } return $path; } function show_false(string $path) { return realpath($path); } foreach ($paths as $path) { var_dump(file_exists($path)); // return true var_dump(realpath($path)); // return false var_dump(let_it_work($path)); // it's work var_dump(show_false($path)); // return false } function entry(DirectoryIterator $dir = null) { if ($dir === null) $dir = new DirectoryIterator(__DIR__); foreach ($dir as $item) { $path = $item->getPathname(); var_dump(file_exists($path)); // true var_dump($item->getRealPath()); // false } } entry(new DirectoryIterator('phar://phar_test.phar')); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71616&edit=1

« previous php.bugs (#234587) next »