|  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.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: Assigned:
Status: Open Package: PHAR related
PHP Version: 7.2.3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
New email:
PHP Version: OS:


 [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-2023 The PHP Group
All rights reserved.
Last updated: Thu Jun 08 05:03:37 2023 UTC