Bug #76475 [Opn->Nab]: phar buildFromIterator misses some directory informations
| From: | cmb@php.net | Date: | Wed, 27 Jan 2021 13:04:12 +0000 |
| Subject: | Bug #76475 [Opn->Nab]: phar buildFromIterator misses some directory informations | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231795@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76475&edit=1
ID: 76475
Updated by: cmb@php.net
Reported by: dams@php.net
Summary: phar buildFromIterator misses some directory
informations
-Status: Open
+Status: Not a bug
Type: Bug
Package: PHAR related
Operating System: OSX
PHP Version: 7.2.6
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
In the given test script, the ::addFile() variant explicitly skips
. and ... To archive the same for ::buildFromIterator(), you
have to pass FilesystemIterator::SKIP_DOTS as $flags to
RecursiveDirectoryIterator::construct().
So this is not a bug, and there is already request #72046
regarding supporting directories.
Previous Comments:
------------------------------------------------------------------------
[2018-06-15 08:09:54] dams@php.net
Here is the link to the code : https://gist.github.com/dseguy/1074014a63509da970c48aac87d8761f#file-phar-buildfromiterator
------------------------------------------------------------------------
[2018-06-14 10:38:08] dams@php.net
Description:
------------
When building a phar with addFile, it is possible to list the folders with scandir or opendir.
When building the same phar with buildFromIterator, some of the folders in the phar archive
can't be read. I get the following error :
PHP Warning: scandir(phar:///tmp/iterator.phar/folder/sub): failed to open dir: operation failed in
phar:///tmp/iterator.phar/test on line 3
Test script:
---------------
The attached gist creates a few files, and build 2 phar with the same structure.
The one created with iterator fails, while the other one is OK, displaying a folder listing.
Expected result:
----------------
Building phar with archives allows for all folder listing.
Actual result:
--------------
error when using scandir, opendir in the phar.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76475&edit=1