From 797cd3d25a5411bef7eea9d3b8c38c567bc4635b Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Mon, 27 Jan 2020 15:38:50 -0600 Subject: Merge pull request #5893 from aitorres/develop ZIP Library Memory Optimization --- system/libraries/Zip.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Zip.php') diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index c0a14023d..44f73aead 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -406,13 +406,13 @@ class CI_Zip { return FALSE; } - return $this->zipdata - .$this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00" + $footer = $this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00" .pack('v', $this->entries) // total # of entries "on this disk" .pack('v', $this->entries) // total # of entries overall .pack('V', self::strlen($this->directory)) // size of central dir .pack('V', self::strlen($this->zipdata)) // offset to start of central dir ."\x00\x00"; // .zip file comment length + return $this->zipdata . $footer; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From ced499f7ad90ff8bb6bf0faa2e24a1593204de9a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 28 Jan 2020 21:13:04 +0200 Subject: [ci skip] Add comment about PR #5893 changes --- system/libraries/Zip.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/libraries/Zip.php') diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 44f73aead..52fac2f8a 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -406,13 +406,14 @@ class CI_Zip { return FALSE; } + // @see https://github.com/bcit-ci/CodeIgniter/issues/5864 $footer = $this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00" .pack('v', $this->entries) // total # of entries "on this disk" .pack('v', $this->entries) // total # of entries overall .pack('V', self::strlen($this->directory)) // size of central dir .pack('V', self::strlen($this->zipdata)) // offset to start of central dir ."\x00\x00"; // .zip file comment length - return $this->zipdata . $footer; + return $this->zipdata.$footer; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b