|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76061 Phar wrapper and extensionless files
Submitted: 2018-03-06 13:19 UTC Modified: 2018-08-20 13:48 UTC
Avg. Score:4.8 ± 0.4
Reproduced:6 of 6 (100.0%)
Same Version:6 (100.0%)
Same OS:6 (100.0%)
From: maikuolan at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: PHAR related
PHP Version: Irrelevant OS: Linux/*nix/Win
Private report: No CVE-ID: None
 [2018-03-06 13:19 UTC] maikuolan at gmail dot com
Attempting to access extensionless ZIP archives using the `phar://` wrapper results in errors.

Examples (assumes the file being read is an arbitrary ZIP archive containing one or more files):

%PATH%>php.exe -r "$foo=scandir('phar://x:/');var_dump($foo);

..generates an array whereby elements represent the files contained by the archive (expected).

Whereas this:
%PATH%>php.exe -r "$foo=scandir('phar://x:/xxx');var_dump($foo);

..generates this (not expected):
PHP Warning:  scandir(phar://x:/xxx): failed to open dir: phar error: no directory in "phar://x:/xxx", must have at least phar://x:/xxx/ for root directory (always use full path to a new phar)
phar url "phar://x:/xxx" is unknown in Command line code on line 1
PHP Warning:  scandir(): (errno 9): Bad file descriptor in Command line code on line 1

Bug discovered via:

Reproduced against latest releases on all currently supported branches (5.6, 7.0, 7.1, 7.2). Not tested against any older versions or unsupported branches.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-16 08:15 UTC] maikuolan at gmail dot com
#76061 and #76128 might be related (not sure).
 [2018-08-20 13:48 UTC]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2018-08-20 13:48 UTC]
Closing as duplicate of request #76128.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 13:01:28 2024 UTC