Bug #75102 [PATCH]: `PharData` says invalid checksum for valid tar

From: Date: Wed, 02 Dec 2020 15:11:36 +0000
Subject: Bug #75102 [PATCH]: `PharData` says invalid checksum for valid tar
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230796@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75102&edit=1

 ID:                 75102
 Patch added by:     cmb@php.net
 Reported by:        d28b312d at opayq dot com
 Summary:            PharData says invalid checksum for valid tar
 Status:             Verified
 Type:               Bug
 Package:            PHAR related
 Operating System:   *
 PHP Version:        Irrelevant
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

The following pull request has been associated:

Patch Name: Fix #75102: PharData says invalid checksum for valid tar
On GitHub:  https://github.com/php/php-src/pull/6479
Patch:      https://github.com/php/php-src/pull/6479.patch


Previous Comments:
------------------------------------------------------------------------
[2017-08-25 17:30:27] cmb@php.net

I can confirm this issue on Linux and Windows. Changing the OS
entry accordingly.

------------------------------------------------------------------------
[2017-08-21 16:28:41] d28b312d at opayq dot com

Description:
------------
Found an example of a valid tgz file which is a valid tar file, but complains about an invalid
checksum.

It extracts with tar -xvzf /tmp/foo.tgz and also extracts fine from 7zip.

I have also tried decompressing it before using PharData and it still fails which means
it's not the decompression doing it.

Test script:
---------------
<?php

$download = 'http://thrysoee.dk/editline/libedit-20100424-3.0.tar.gz';
$file = '/tmp/libedit20100424.tgz';

file_put_contents($file, fopen($download, 'r'));
var_dump(new PharData($file));

Expected result:
----------------
To see the PharData object in the console.

Actual result:
--------------
PHP Fatal error:  Uncaught UnexpectedValueException: phar error:
"/tmp/libedit20100424.tgz" is a corrupted tar file (checksum mismatch of file
"libedit-20100424-3.0") in /tmp/phpbugtest2.php:7
Stack trace:
#0 /tmp/phpbugtest2.php(7): PharData->__construct('/tmp/libedit201...')
#1 {main}
  thrown in /tmp/phpbugtest2.php on line 7


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=75102&edit=1


Thread (4 messages)

« previous php.bugs (#230796) next »