php.net |  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
Votes:6
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
Description:
------------
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):

This:
```
%PATH%>php.exe -r "$foo=scandir('phar://x:/xxx.xxx');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
bool(false)
```

Bug discovered via: https://github.com/phpMussel/phpMussel/issues/155

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.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-16 08:15 UTC] maikuolan at gmail dot com
#76061 and #76128 might be related (not sure).

https://bugs.php.net/bug.php?id=76061
https://bugs.php.net/bug.php?id=76128
 [2018-08-20 13:48 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2018-08-20 13:48 UTC] cmb@php.net
Closing as duplicate of request #76128.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 08:01:35 2019 UTC