php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #76128 PHAR file detection is broken
Submitted: 2018-03-21 13:44 UTC Modified: 2018-08-14 16:46 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: kelunik@php.net Assigned:
Status: Open Package: PHAR related
PHP Version: 7.2.3 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
23 + 21 = ?
Subscribe to this entry?

 
 [2018-03-21 13:44 UTC] kelunik@php.net
Description:
------------
Detecting the PHAR in a file path like 'phar:///home/kelunik/acme-client.phar/vendor/autoload.php' works, but it fails if there's no '.phar' extension. 'phar:///home/kelunik/acme-client/vendor/autoload.php' therefore doesn't work if the PHAR is renamed to 'acme-client'.

Finding the PHAR in such a path isn't possible with quite some I/O. Because of that, I propose to use a non-valid character such as a NUL-byte to separate the PHAR path from the path inside the PHAR.

I think Java uses ! or # or so as a separator.

Expected result:
----------------
File functions work regardless of the file name of the PHAR.

Actual result:
--------------
File functions are broken if the PHAR doesn't end with '.phar'.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-16 08:16 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-14 16:46 UTC] cmb@php.net
-Type: Bug +Type: Feature/Change Request
 [2018-08-14 16:46 UTC] cmb@php.net
The documentation states[1]:

| The file name's extension must contain .phar.

So this is not a bug, but rather a feature request, in my opinion.

[1] <http://php.net/manual/en/phar.construct.php>
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 16:01:43 2019 UTC