From 835c9835d0c700f6eb75e186e9fa38041a1b2693 Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 23 Feb 2006 23:54:34 +0000 Subject: [PATCH] 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 --- phpBB/includes/functions_compress.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index 165de43e0c..31627d29a1 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -527,7 +527,7 @@ class compress_tar extends compress 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); } }