|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46939 fatal error on new Phar
Submitted: 2008-12-24 16:06 UTC Modified: 2008-12-25 17:56 UTC
From: lunter at interia dot pl Assigned: cellog (profile)
Status: Not a bug Package: PHAR related
PHP Version: 5.3.0alpha3 OS: WinXP
Private report: No CVE-ID: None
 [2008-12-24 16:06 UTC] lunter at interia dot pl
This PHP code triggers:

Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Cannot create phar 'core.php', file extension (or combination) not recognised' in C:\htdocs\a\!phar2.php:2 Stack trace: #0 C:\htdocs\a\!phar2.php(2): Phar->__construct('core.php') #1 {main} thrown in C:\htdocs\a\!phar2.php on line 2

but *.php files work as good as *.phar

when using:
2) require('phar://file.php');

Reproduce code:
 $p=new Phar('core.php');

Expected result:
NO Fatal error wheh extension is *.php (*.php5, *.php6)

Actual result:
Fatal error wheh extension is *.php (*.php5, *.php6)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-25 04:33 UTC]
This is an intended side effect.  .zip and .tar-based phar archives will not work if .phar is not in the name, and so allowing creation of them is not allowed.  If we allowed this for phar-based phar archives, it would be inconsistent and confusing.

We are, of course, in alpha stage, but it would be a major change to do this.

What is the workaround?

blah.phar.php or blah.phar.php5 or blah.phar.php6 all work.  If you would like to discuss alternatives, I am happy to do so, either on or through email at
 [2008-12-25 17:56 UTC] lunter at interia dot pl
I dont't know that *.phar.* are allowed.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jul 27 14:01:25 2021 UTC