Appending to the string is faster than copying it. Additionally, str_repeat is optimized for strings like "\0". This issue only came up with really, really large files to compress ( 150 MB + !)

git-svn-id: file:///svn/phpbb/trunk@5578 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2006-02-23 23:54:34 +00:00
parent 718a2bf4cd
commit 835c9835d0

View file

@ -527,7 +527,7 @@ class compress_tar extends compress
if ($stat[7] !== 0 && !$is_dir) if ($stat[7] !== 0 && !$is_dir)
{ {
$fzwrite($this->fp, pack('a'.($stat[7] + 512 - $stat[7] % 512), $data)); $fzwrite($this->fp, $data . (($stat[7] % 512 > 0) ? str_repeat("\0", 512 - $stat[7] % 512) : ''));
unset($data); unset($data);
} }
} }