Permalink
Browse files

Bug #18702 - use prefix to allow long filenames (patch by Hannes Land…

…eholm)

git-svn-id: https://svn.php.net/repository/pear/packages/Archive_Tar/trunk@314430 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 50cd9db commit 1683c97ec9ae227588f245dc9f1d63cf2cebee8e @mrook mrook committed Aug 7, 2011
Showing with 8 additions and 4 deletions.
  1. +8 −4 Archive/Tar.php
View
@@ -1343,10 +1343,14 @@ function _readHeader($v_binary_data, &$v_header)
for ($i=156; $i<512; $i++)
$v_checksum+=ord(substr($v_binary_data,$i,1));
- $v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"
- ."a8checksum/a1typeflag/a100link/a6magic/a2version/"
- ."a32uname/a32gname/a8devmajor/a8devminor",
- $v_binary_data);
+ $v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/" .
+ "a8checksum/a1typeflag/a100link/a6magic/a2version/" .
+ "a32uname/a32gname/a8devmajor/a8devminor/a131prefix",
+ $v_binary_data);
+
+ if (strlen($v_data["prefix"]) > 0) {
+ $v_data["filename"] = "$v_data[prefix]/$v_data[filename]";
+ }
// ----- Extract the checksum
$v_header['checksum'] = OctDec(trim($v_data['checksum']));

0 comments on commit 1683c97

Please sign in to comment.