|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-06-13 11:47 UTC] matthias dot burtscher at fusonic dot net
Description:
------------
When creating a Phar archive with a very simple Phar::createFromDirectory() call
(see test script) the generated archive is corrupt sometimes, depending on the
contents packed into the Phar.
I CAN PROVIDE THE TEST CONTENTS TO A DEVELOPER BUT NOT TO THE PUBLIC.
Opening the Phar will cause a Fatal error. Adding an additional empty file (see
test script) to the archive fixes the problem. Sometimes a second empty file has
to be added, sometimes a third one.
Tested PHP versions:
- 5.3.26
- 5.4.16
- 5.5.0 RC3
Configure line (all versions):
'./configure'
'--prefix=/opt/php/bin/php-5.3.26'
'--with-gd'
'--with-ldap=/usr'
'--with-mysql'
'--with-mssql'
'--with-pdo-mysql'
'--with-pdo-dblib'
'--with-pdo-pgsql'
'--with-pgsql'
'--with-config-file-path=/opt/php/bin/php-5.3.26/etc'
'--enable-mbstring'
'--with-mcrypt'
'--with-openssl'
'--with-curl'
'--with-zlib'
'--with-libdir=lib/x86_64-linux-gnu'
'--with-jpeg-dir'
'--with-png-dir'
Test script:
---------------
// Corrupt
$phar = new Phar("test.phar");
$phar->buildFromDirectory("content");
$phar->compress(Phar::GZ);
// Working (only difference is adding the empty file)
$phar = new Phar("test.phar");
$phar->buildFromDirectory("content");
$phar->addFromString("an-empty-file", "");
$phar->compress(Phar::GZ);
Expected result:
----------------
Working phar archive which can be opened with "new Phar('test.phar')".
Actual result:
--------------
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'internal
corruption of phar "/tmp/test/test.phar" (truncated manifest at stub end)'
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 10:00:01 2025 UTC |
This one will result in the same corrupt phar archive: $phar = new Phar("test.phar"); $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("/tmp/test/content", FilesystemIterator::SKIP_DOTS)); $phar->buildFromIterator($iterator, "/tmp/test/content"); $phar->compress(Phar::GZ);