php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67865 internal corruption phar error
Submitted: 2014-08-19 13:41 UTC Modified: 2014-08-21 06:58 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: pear at laurent-laville dot org Assigned: mike (profile)
Status: Closed Package: PHAR related
PHP Version: 5.6.0RC4 OS: Windows
Private report: No CVE-ID: None
 [2014-08-19 13:41 UTC] pear at laurent-laville dot org
Description:
------------
I got recently lot of internal corruption error with phar distribution of many packages.

First I think it come from each libraries/packages, before to realize that I got the same error on latest unstable versions PHP 5.6.0RC4, PHP 5.5.16RC1, and PHP 5.4.32RC1

I have no error with others stable PHP versions like 5.4.31, 5.5.15, 5.3.29 

I gave you the well know phing project, but I got the same error with others project and their phar versions on the same PHP RC platforms !


PS: there is an old issue entry at https://bugs.php.net/bug.php?id=53872 that seems to reference the same problem !!!

Test script:
---------------
Try to use for example the phing phar version 2.8.2 available on official site :

http://www.phing.info/get/phing-2.8.2.phar 

And run the command :

php phing-2.8.2.phar -f /path/to/build/build.xml 

where /path/to/build/build.xml identify the build file of phing distribution 
 
https://github.com/phingofficial/phing/blob/master/build/build.xml


Expected result:
----------------
Buildfile: d:\github.com\phingofficial\phing\phing-2.8.2\build\build.xml
      [php] Calling PHP function: dirname()
      [php] Calling PHP function: realpath()

phing > versioncheck:

     [echo] =====================================================
     [echo] Version not specified. You must enter a version. In
     [echo] the future you can add this to build.properties or
     [echo] enter it on the command line:
     [echo]
     [echo] -Dversion=2.0.0b1
     [echo] =====================================================
Phing version for package:

<AND LOT MORE>

Actual result:
--------------
Buildfile: d:\github.com\phingofficial\phing\phing-2.8.2\build\build.xml
[PHP Error] include_once(phar://C:/UwAmp/bin/php/phing-2.8.2.phar/bin/../classes/phing\tasks\ext\PatchTask.php): failed
to open stream: phar error: internal corruption of phar "C:/UwAmp/bin/php/phing-2.8.2.phar" (actual filesize mismatch on file "classes/phing/tasks/ext/PatchTask.php") [line 1093 of phar://C:/UwAmp/bin/php/phing-2.8.2.phar/classes/phing/Phing.php]

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-19 17:07 UTC] jpauli@php.net
This is my output, with 5.6.0RC4 :

Buildfile: /tmp/build.xml
[PHP Error] include_once(phar:///home/julien/Downloads/phing-2.8.2.phar/bin/../classes/phing/tasks/ext/PatchTask.php): failed to open stream: phar error: internal corruption of phar "/home/julien/Downloads/phing-2.8.2.phar" (actual filesize mismatch on file "classes/phing/tasks/ext/PatchTask.php") [line 1093 of phar:///home/julien/Downloads/phing-2.8.2.phar/classes/phing/Phing.php]
[PHP Error] include_once(): Failed opening 'phing/tasks/ext/PatchTask.php' for inclusion (include_path='phar:///home/julien/Downloads/phing-2.8.2.phar/bin/../classes:.:/usr/local/lib/php') [line 1093 of phar:///home/julien/Downloads/phing-2.8.2.phar/classes/phing/Phing.php]

BUILD FAILED
exception 'ConfigurationException' with message 'Error importing phing/tasks/ext/PatchTask.php' in phar:///home/julien/Downloads/phing-2.8.2.phar/classes/phing/Phing.php:1101
Stack trace:
#0 phar:///home/julien/Downloads/phing-2.8.2.phar/classes/phing/Phing.php(1051): Phing::__import('phing/tasks/ext...', NULL)
#1 phar:///home/julien/Downloads/phing-2.8.2.phar/classes/phing/Project.php(569): Phing::import('phing.tasks.ext...', NULL)
#2 phar:///home/julien/Downloads/phing-2.8.2.phar/classes/phing/Project.php(155): Project->addTaskDefinition('patch', 'phing.tasks.ext...')
#3 phar:///home/julien/Downloads/phing-2.8.2.phar/classes/phing/Phing.php(541): Project->init()
#4 phar:///home/julien/Downloads/phing-2.8.2.phar/classes/phing/Phing.php(170): Phing->runBuild()
#5 phar:///home/julien/Downloads/phing-2.8.2.phar/classes/phing/Phing.php(278): Phing::start(Array, NULL)
#6 phar:///home/julien/Downloads/phing-2.8.2.phar/bin/phing.php(43): Phing::fire(Array)
#7 /home/julien/Downloads/phing-2.8.2.phar(11): include('phar:///home/ju...')
#8 {main}

Total time: 0.0847 seconds

Error importing phing/tasks/ext/PatchTask.php
 [2014-08-20 12:21 UTC] jpauli@php.net
Here is a BT :

#0  phar_open_entry_fp (entry=0x7ffff7e18638, error=0x7fffffffad48, follow_links=1) at /home/julien/workspace/php/ext/phar/util.c:779
#1  0x000000000061136b in phar_get_entry_data (ret=0x7fffffffad50, fname=0x1c1dd18 "/home/julien/Downloads/phing-2.8.2.phar", fname_len=39, path=0x1c27768 "classes/phing/tasks/ext/PatchTask.php", path_len=37, mode=0xc08224 "r", allow_dir=0 '\000', error=0x7fffffffad48, security=0) at /home/julien/workspace/php/ext/phar/util.c:482
#2  0x0000000000626d3c in phar_wrapper_open_url (wrapper=0xf53bc0, path=0x1c4ac98 "phar:///home/julien/Downloads/phing-2.8.2.phar/bin/../classes/phing/tasks/ext/PatchTask.php", mode=0xc363e1 "rb", options=129, opened_path=0x7fffffffaf80, context=0x0, __php_stream_call_depth=1, __zend_filename=0xc38b98 "/home/julien/workspace/php/main/streams/streams.c", __zend_lineno=2066, __zend_orig_filename=0xc359f0 "/home/julien/workspace/php/main/main.c", __zend_orig_lineno=1406) at /home/julien/workspace/php/ext/phar/stream.c:286
#3  0x00000000007830b2 in _php_stream_open_wrapper_ex (path=0x1c4ac98 "phar:///home/julien/Downloads/phing-2.8.2.phar/bin/../classes/phing/tasks/ext/PatchTask.php", mode=0xc363e1 "rb", options=137, opened_path=0x7fffffffaf80, context=0x0, __php_stream_call_depth=0, __zend_filename=0xc359f0 "/home/julien/workspace/php/main/main.c", __zend_lineno=1406, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /home/julien/workspace/php/main/streams/streams.c:2064
#4  0x0000000000761e07 in php_stream_open_for_zend_ex (filename=0x1c4ac98 "phar:///home/julien/Downloads/phing-2.8.2.phar/bin/../classes/phing/tasks/ext/PatchTask.php", handle=0x7fffffffaf70, mode=137) at /home/julien/workspace/php/main/main.c:1406
#5  0x0000000000761da1 in php_stream_open_for_zend (filename=0x1c4ac98 "phar:///home/julien/Downloads/phing-2.8.2.phar/bin/../classes/phing/tasks/ext/PatchTask.php", handle=0x7fffffffaf70) at /home/julien/workspace/php/main/main.c:1398
#6  0x00000000008181b6 in zend_stream_open (filename=0x1c4ac98 "phar:///home/julien/Downloads/phing-2.8.2.phar/bin/../classes/phing/tasks/ext/PatchTask.php", handle=0x7fffffffaf70) at /home/julien/workspace/php/Zend/zend_stream.c:132
#7  0x000000000088db41 in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (execute_data=0x7ffff7f9f3a0) at /home/julien/workspace/php/Zend/zend_vm_execute.h:31281
#8  0x000000000083caad in execute_ex (execute_data=0x7ffff7f9f3a0) at /home/julien/workspace/php/Zend/zend_vm_execute.h:363
#9  0x000000000083cb35 in zend_execute (op_array=0x7ffff7e06070) at /home/julien/workspace/php/Zend/zend_vm_execute.h:388
#10 0x00000000007f92e6 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/julien/workspace/php/Zend/zend.c:1330
#11 0x00000000007643f2 in php_execute_script (primary_file=0x7fffffffe5b0) at /home/julien/workspace/php/main/main.c:2584
#12 0x00000000008aa7ab in do_cli (argc=4, argv=0xf77780) at /home/julien/workspace/php/sapi/cli/php_cli.c:994
#13 0x00000000008ab8e3 in main (argc=4, argv=0xf77780) at /home/julien/workspace/php/sapi/cli/php_cli.c:1378
 [2014-08-20 15:24 UTC] tyrael@php.net
-Assigned To: +Assigned To: mike
 [2014-08-20 15:24 UTC] tyrael@php.net
reverting e4ff7f2ee346d641715694209e61704c9e815483 seems to fix the issue.
assigning Mike to the issue, as he is the author of that commit.
 [2014-08-20 15:33 UTC] tyrael@php.net
as the 5.4 and 5.5 releases should be released this week, I think reverting that commit would be the better solution, as the bug which this commit fixes(https://bugs.php.net/bug.php?id=67724) seems to be affecting less people.
 [2014-08-20 16:49 UTC] mike@php.net
Not sure how #67724 affects this, but +1 to revert if we do not find the cause now.
 [2014-08-20 17:26 UTC] mike@php.net
Fix is coming
 [2014-08-21 06:58 UTC] pear at laurent-laville dot org
It seems that the issue was fixed on PHP 5.4.32

PHP 5.4.32 (cli) (built: Aug 21 2014 01:30:47)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

But NOT on PHP 5.5.16 

PHP 5.5.16 (cli) (built: Aug 20 2014 17:25:17)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies


I pick both versions from site  http://windows.php.net/download/

PHP 5.4.32  sha1: 6f50c17a01ab1aaed9580c6567af7495ef39e276
PHP 5.5.16  sha1: 1e92fcf6d7c2390861548638987a664ca87a809d
 [2014-08-21 10:26 UTC] neweracracker at gmail dot com
Afaik stas reverted the commit in PHP 5.4.32 by 20 Aug 20:15 and the package at windows.php.net was produced at 21 Aug 02:26 so it contains the fix as you state. The only thing that wasn't reverted was the NEWS file.

I also downloaded the refreshed source package from downloads.php.net yesterday for archival: php-5.4.32.tar.bz2 md5: 0de30057773755c742ef4916c473292c

Regarding PHP 5.5.16 commit was reverted and tagged at 21 Aug 08:45 so the windows.php.net package produced at 21 Aug 03:46 does not contain the fix.

PS: downloads.php.net and snaps.php.net are down as I write this. Please fix it.
 [2014-08-21 11:10 UTC] neweracracker at gmail dot com
Also as a side note, the date in the NEWS of PHP 5.4.32 tarball is wrong. It was not released 07 Aug 2014, that is the date of the RC1, not the final.

PS: downloads.php.net and snaps.php.net seem to be back.
 [2014-08-21 20:46 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=54fbbded372b771cf281a73e1981cde642107924
Log: fix bug #67865
 [2014-08-21 20:46 UTC] mike@php.net
-Status: Assigned +Status: Closed
 [2014-08-25 16:15 UTC] jpauli@php.net
Hi,

What you did is downloads packages from XYZ.php.net without waiting for the official announcements.

When we (RM) publish the official announcements, this means all is right to us, and PHP users are safe to use the new archives (except human-being errors, uncommon).

For Windows packages, we had a problem as the Windows packages for 5.5 were built against the wrong code. But that's been done before official announcements, when we (RM team) were preparing those packages, so nobody should have been inpacted.

We leave in different timezones through the world, and sometimes things take 12 to 24h to be fixed.

5.5 Windows builds are now OK and 5.5.16 is announced.
 [2014-10-07 23:13 UTC] stas@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=54fbbded372b771cf281a73e1981cde642107924
Log: fix bug #67865
 [2014-10-07 23:24 UTC] stas@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=54fbbded372b771cf281a73e1981cde642107924
Log: fix bug #67865
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC