Skip to content

Commit

Permalink
archive.inc fixed for PHP < 5.5 unpack() function
Browse files Browse the repository at this point in the history
  • Loading branch information
apmuthu committed Jan 31, 2021
1 parent fe7c8f2 commit 7cac736
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions FA24Mods/CHANGELOG_FA24Mods.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Files in this folder overwrite their counterparts in the core to effect the mods by Ap.Muthu.

2021-01-31 archive.inc fixed for PHP < 5.5 unpack() function
2021-01-31 Cloned archive.inc for PHP < 5.5 unpack fix
2020-12-16 PHP < 5.4 compatibility fix moved to core
2020-12-15 PHP < 5.4 compatibility fixed
Expand Down
5 changes: 4 additions & 1 deletion FA24Mods/includes/archive.inc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,10 @@ class tar_file extends archive

while ($block = fread($fp, 512))
{
$temp = unpack("Z100name/Z8mode/Z8uid/Z8gid/Z12size/Z12mtime/Z8checksum/Z1type/Z100symlink/Z6magic/Z2temp/Z32temp/Z32temp/Z8temp/Z8temp/Z155prefix/Z12temp", $block);
if (version_compare(PHP_VERSION, '5.5.0') >= 0)
$temp = unpack("Z100name/Z8mode/Z8uid/Z8gid/Z12size/Z12mtime/Z8checksum/Z1type/Z100symlink/Z6magic/Z2temp/Z32temp/Z32temp/Z8temp/Z8temp/Z155prefix/Z12temp", $block);
else
$temp = unpack("a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp", $block);

$file = array (
'name' => rtrim($temp['prefix']) . rtrim($temp['name']),
Expand Down

0 comments on commit 7cac736

Please sign in to comment.