|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62368 IonCube encoded files cannot work inside PHAR
Submitted: 2012-06-20 07:49 UTC Modified: 2012-06-20 17:35 UTC
From: stawi at plusnet dot pl Assigned:
Status: Not a bug Package: PHAR related
PHP Version: 5.4.4 OS: Debian
Private report: No CVE-ID: None
 [2012-06-20 07:49 UTC] stawi at plusnet dot pl
=== uname -a ===
Linux debian 3.0.0-1-amd64 #1 SMP Sat Aug 27 16:21:11 UTC 2011 x86_64 GNU/Linux

=== php -v ===
PHP 5.4.0-2 (cli) (built: Mar  5 2012 12:52:15) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
with the ionCube PHP Loader v4.2.1, Copyright (c) 2002-2012, by ionCube Ltd.

When i put a IonCube encoded file into PHAR archive and then try to include it I get that says file is corrupted.

I mailed to IonCube and they said this is PHP issue not theirs ;)

I believe that this will happen to all encoders and maybe optimizers.

Test script:
=== dummy.php ===
echo "Hello world!\n";

=== encoded.php
// Same as dummy.php but encoded.

=== test.phar ===
// Nothing special here, just added 2 files.

=== test.php ===
include 'phar://test.phar/dummy.php';
include 'phar://test.phar/encoded.php';
echo "DONE!\n";

Expected result:
Hello world!
Hello world!

Actual result:
Hello world!
The file phar:///home/www/test.phar/encoded.php is corrupted.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-20 17:35 UTC]
-Status: Open +Status: Not a bug
 [2012-06-20 17:35 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The IonCube guys are welcome to discuss their issues or provide patches. We don't know what they do, what issues they have.
 [2012-06-20 17:48 UTC] stawi at plusnet dot pl
Well OK.. Seems that IonCube guys need to work bit more ;)
 [2012-06-24 12:18 UTC] dev at ioncube dot com
To be clear, this is not a bug in PHP and we wouldn't have claimed it to be because we know precisely why PHAR's *can't* work due to the way that files are handled by the Loader.  (I did check our helpdesk and our very good apprentices in training don't appear to have claimed it as a PHP issue either.) 

We like the idea of PHAR's though, and came up with the PHAR concept ourselves long before it appeared in PHP as it's an appealing way to package an application or component; but it does have downsides hence never pursuing it ourselves. The Loader has an I/O abstraction mechanism and could probably be augmented to handle PHAR's, and it is something we already have tracked in our Mantis system, however demand from customers has been low for the feature hence it not making it into the product thus far.
 [2012-06-25 13:25 UTC] stawi at plusnet dot pl
To dev @ ioncube:
Information that it is PHP problem I received from from Polish reseller of IonCube.

Anyway, you have working version (in Mantis) but you wont add it in IonCube? I dont get it..
Low demand? So all features you have are fully used by all customers? you must be joking..
Even if few % of customers demand it, they will probably buy other encoder so you lost money.
PHARs are perfect for module based systems espesially when you need to make an update - just upload few PHARs instead of thousands of files. Works perfectly with self updateing software, but we need encoding ;/
 [2012-06-25 15:31 UTC] dev at ioncube dot com
"Information that it is PHP problem I received from from Polish reseller of IonCube."

Clearly a misunderstanding somewhere in the chain after we spoke with them last week. The topic is covered at and I believe that they emailed you to say that it's not possible to use PHAR, but without blaming PHP. Anyway...

"you have working version (in Mantis) but you wont add it in IonCube"

Mantis is a bug/feature tracker. We have a note in Mantis to the effect that we don't support PHARs but could in the future. We've never implemented it though, and it likely requires a different and potentially less efficient approach to the file access techniques that are used currently, not that this would be a reason not to do it.

Any deployment choice has its pros and cons, but if an entire application or module is in a PHAR and just one file needs to be updated, choosing a PHAR might prove not to have been the best choice after all. A tool such as ionCube IPF, which from Linux or Windows can create Windows setup.exe's to handle product deployment automatically and with the same ease as a local app install, might be a good way to go. 

If you have further questions I would recommend creating a ticket at and we'll be happy to assist there.
 [2019-12-23 09:37 UTC] murznn at gmail dot com
Does anybody report this issue to IonCube? If yes, can you share link to issue or his reply about this problem?
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Aug 02 23:01:23 2021 UTC