|  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
Avg. Score:4.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: 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:
Solve the problem:
12 + 12 = ?
Subscribe to this entry?

 [2018-03-21 13:44 UTC]
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'.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-16 08:16 UTC] maikuolan at gmail dot com
#76061 and #76128 might be related (not sure).
 [2018-08-14 16:46 UTC]
-Type: Bug +Type: Feature/Change Request
 [2018-08-14 16:46 UTC]
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] <>
 [2019-12-12 10:44 UTC] ojrask at gmail dot com
As it seems like a feature request, I would like to +1 the request. It would be nice to have a way to include/require PHARs without the extension in place, and let the developer handle situations where the file being loaded is not an actual PHAR.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 04:01:28 2024 UTC