php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75102 `PharData` says invalid checksum for valid tar
Submitted: 2017-08-21 16:28 UTC Modified: 2020-12-01 16:27 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: d28b312d at opayq dot com Assigned: cmb (profile)
Status: Closed Package: PHAR related
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
 [2017-08-21 16:28 UTC] 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

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-25 17:30 UTC] cmb@php.net
-Status: Open +Status: Verified -Operating System: Windows 10 + Cygwin +Operating System: *
 [2017-08-25 17:30 UTC] cmb@php.net
I can confirm this issue on Linux and Windows. Changing the OS
entry accordingly.
 [2020-12-01 16:27 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-12-02 15:11 UTC] cmb@php.net
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
 [2020-12-04 12:05 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8588ae72156eeead928a8fe93bb8a5ab293f1e89
Log: Fix #75102: `PharData` says invalid checksum for valid tar
 [2020-12-04 12:05 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC