I`m trying to extract a tar file using Phar Classe, but is returning the following error:
UnexpectedValueException Object ( [message:protected] => phar error: "/home/filelocation/file.tar" is a corrupted tar file (truncated) [string:Exception:private] => [code:protected] => 0 [file:protected] => /home/inplan/public_html/uncompress_files.php [line:protected] => 89 [trace:Exception:private] => Array ( [0] => Array ( [file] => /home/inplan/public_html/uncompress_files.php [line] => 89 [function] => __construct [class] => PharData [type] => -> [args] => Array ( [0] => uploads/maps/true_color_4.tar ) ) ) [previous:Exception:private] => )
PHP:
try {
$phar = new PharData('uploads/maps/true_color_'.$id_technical_report.'.tar');
$phar2 = $phar->convertToExecutable (Phar::TAR,Phar::NONE);
$phar2->extractTo('uploads/maps/');
} catch (Exception $e) {
print_r($e);
}
When I download this file, I can open and extract normally using Winrar.
The file is generated by an API from Sentinel Hub (https://services.sentinel-hub.com/api/v1/process)
Any ideas why is this happening?
Thanks