From: Alexander Ebert Date: Tue, 6 Jun 2017 11:27:56 +0000 (+0200) Subject: Fixed an compatibility issue with PHP 7 X-Git-Tag: 2.1.16~13 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f77253a99aa54dc331f2ed11896d8bbcf1cf43fc;p=GitHub%2FWoltLab%2FWCF.git Fixed an compatibility issue with PHP 7 See db8aa273d6eec8f364800681daf3e0a74cb2a624 --- diff --git a/wcfsetup/install.php b/wcfsetup/install.php index 958d4e263a..827262db6d 100644 --- a/wcfsetup/install.php +++ b/wcfsetup/install.php @@ -585,15 +585,32 @@ class Tar { $i = 0; // Read the 512 bytes header + $longFilename = null; while (strlen($binaryData = $this->file->read(512)) != 0) { // read header $header = $this->readHeader($binaryData); if ($header === false) { continue; } - $this->contentList[$i] = $header; - $this->contentList[$i]['index'] = $i; - $i++; + // fixes a bug that files with long names aren't correctly + // extracted + if ($longFilename !== null) { + $header['filename'] = $longFilename; + $longFilename = null; + } + if ($header['typeflag'] == 'L') { + $format = 'Z' . $header['size'] . 'filename'; + + $fileData = unpack($format, $this->file->read(512)); + $longFilename = $fileData['filename']; + $header['size'] = 0; + } + // don't include the @LongLink file in the content list + else { + $this->contentList[$i] = $header; + $this->contentList[$i]['index'] = $i; + $i++; + } $this->file->seek($this->file->tell() + (512 * ceil(($header['size'] / 512)))); }