From 74a87aef6545755c873308290d9605efe9a01c86 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 8 Oct 2019 10:15:27 +0300 Subject: [ci skip] Fix #5840 --- system/libraries/Cache/drivers/Cache_redis.php | 27 +++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index bff96fbfb..b72fb896a 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -83,6 +83,13 @@ class CI_Cache_redis extends CI_Driver */ protected static $_delete_name; + /** + * sRem()/sRemove() method name depending on phpRedis version + * + * @var string + */ + protected static $_delete_name; + // ------------------------------------------------------------------------ /** @@ -104,9 +111,19 @@ class CI_Cache_redis extends CI_Driver return; } - isset(static::$_delete_name) OR static::$_delete_name = version_compare(phpversion('phpredis'), '5', '>=') - ? 'del' - : 'delete'; + if ( ! isset(static::$_delete_name, static::$_sRemove_name)) + { + if (version_compare(phpversion('phpredis'), '5', '>=')) + { + static::$_delete_name = 'del'; + static::$_sRemove_name = 'sRem'; + } + else + { + static::$_delete_name = 'delete'; + static::$_sRemove_name = 'sRemove'; + } + } $CI =& get_instance(); @@ -193,7 +210,7 @@ class CI_Cache_redis extends CI_Driver } else { - $this->_redis->sRemove('_ci_redis_serialized', $id); + $this->_redis->{static::$_sRemove_name}('_ci_redis_serialized', $id); } return $this->_redis->set($id, $data, $ttl); @@ -214,7 +231,7 @@ class CI_Cache_redis extends CI_Driver return FALSE; } - $this->_redis->sRemove('_ci_redis_serialized', $key); + $this->_redis->{static::$_sRemove_name}('_ci_redis_serialized', $key); return TRUE; } -- cgit v1.2.3-24-g4f1b From deae7d79db2b4f157df32356c6c3e8acde6de3fb Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 8 Oct 2019 10:37:45 +0300 Subject: Merge pull request #5842 from sapics/chore/fix-indent Fix indentation / clear whitespace --- system/libraries/Cache/drivers/Cache_apc.php | 8 ++++---- system/libraries/Cache/drivers/Cache_dummy.php | 8 ++++---- system/libraries/Cache/drivers/Cache_wincache.php | 8 ++++---- system/libraries/Profiler.php | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index 8da8854ee..c0527e665 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -160,10 +160,10 @@ class CI_Cache_apc extends CI_Driver { * @param string user/filehits * @return mixed array on success, false on failure */ - public function cache_info($type = NULL) - { - return apc_cache_info($type); - } + public function cache_info($type = NULL) + { + return apc_cache_info($type); + } // ------------------------------------------------------------------------ diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php index fdb9042ef..0a90d0692 100644 --- a/system/libraries/Cache/drivers/Cache_dummy.php +++ b/system/libraries/Cache/drivers/Cache_dummy.php @@ -138,10 +138,10 @@ class CI_Cache_dummy extends CI_Driver { * @param string user/filehits * @return bool FALSE */ - public function cache_info($type = NULL) - { - return FALSE; - } + public function cache_info($type = NULL) + { + return FALSE; + } // ------------------------------------------------------------------------ diff --git a/system/libraries/Cache/drivers/Cache_wincache.php b/system/libraries/Cache/drivers/Cache_wincache.php index 1feaa158f..c20d0bc91 100644 --- a/system/libraries/Cache/drivers/Cache_wincache.php +++ b/system/libraries/Cache/drivers/Cache_wincache.php @@ -169,10 +169,10 @@ class CI_Cache_wincache extends CI_Driver { * * @return mixed array on success, false on failure */ - public function cache_info() - { - return wincache_ucache_info(TRUE); - } + public function cache_info() + { + return wincache_ucache_info(TRUE); + } // ------------------------------------------------------------------------ diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 77af7b99b..d7a171f26 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -486,13 +486,13 @@ class CI_Profiler { { $pre = ''; $pre_close = ''; - + if (is_array($val) OR is_object($val)) { $val = print_r($val, TRUE); - + $pre = '
' ;
- 				$pre_close = '
'; + $pre_close = ''; } $output .= '' @@ -524,13 +524,13 @@ class CI_Profiler { { $pre = ''; $pre_close = ''; - + if (is_array($val) OR is_object($val)) { $val = print_r($val, TRUE); - + $pre = '
' ;
- 				$pre_close = '
'; + $pre_close = ''; } $output .= '' -- cgit v1.2.3-24-g4f1b From 374386e402288f868f4a9c2cff2b4f8786d026bd Mon Sep 17 00:00:00 2001 From: Claudio Galdiolo Date: Thu, 10 Oct 2019 18:01:49 +0200 Subject: fix static field name field with name $_delete_name already defined, use $_sRemove_name --- system/libraries/Cache/drivers/Cache_redis.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries') diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index b72fb896a..0539e2cdf 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -88,7 +88,7 @@ class CI_Cache_redis extends CI_Driver * * @var string */ - protected static $_delete_name; + protected static $_sRemove_name; // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From 6fd8d3f5180700e9b288d2d8446b5e09413c6230 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 21 Oct 2019 11:18:12 +0300 Subject: [ci skip] Fix #5857 --- system/libraries/Session/drivers/Session_files_driver.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'system/libraries') diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php index 2899b7dec..d9966273b 100644 --- a/system/libraries/Session/drivers/Session_files_driver.php +++ b/system/libraries/Session/drivers/Session_files_driver.php @@ -196,6 +196,10 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle $this->_fingerprint = md5(''); return ''; } + + // Prevent possible data corruption + // See https://github.com/bcit-ci/CodeIgniter/issues/5857 + clearstatcache(TRUE, $this->_file_path.$session_id); } // We shouldn't need this, but apparently we do ... // See https://github.com/bcit-ci/CodeIgniter/issues/4039 -- cgit v1.2.3-24-g4f1b From beebaccc0a06c22b4af06ec913e501c7e116c60e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 1 Nov 2019 12:24:03 +0200 Subject: [ci skip] Merge pull request #5861 from nebkat/patch-1 cache: redis: Check version of redis not phpredis --- system/libraries/Cache/drivers/Cache_redis.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries') diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index 0539e2cdf..f0a72ee3c 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -113,7 +113,7 @@ class CI_Cache_redis extends CI_Driver if ( ! isset(static::$_delete_name, static::$_sRemove_name)) { - if (version_compare(phpversion('phpredis'), '5', '>=')) + if (version_compare(phpversion('redis'), '5', '>=')) { static::$_delete_name = 'del'; static::$_sRemove_name = 'sRem'; -- cgit v1.2.3-24-g4f1b From 748b2280c63e994f4153bdafb683606df8213bc3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 27 Jan 2020 19:26:03 +0200 Subject: [ci skip] Fix #5879 --- system/libraries/Profiler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index d7a171f26..e3c4bd10a 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -105,7 +105,7 @@ class CI_Profiler { { if ( ! isset($config[$section])) { - $this->_compile_{$section} = TRUE; + $this->{'_compile_'.$section} = TRUE; } } @@ -135,7 +135,7 @@ class CI_Profiler { { if (in_array($method, $this->_available_sections)) { - $this->_compile_{$method} = ($enable !== FALSE); + $this->{'_compile_'.$method} = ($enable !== FALSE); } } } @@ -554,7 +554,7 @@ class CI_Profiler { foreach ($this->_available_sections as $section) { - if ($this->_compile_{$section} !== FALSE) + if ($this->{'_compile_'.$section} !== FALSE) { $func = '_compile_'.$section; $output .= $this->{$func}(); -- cgit v1.2.3-24-g4f1b 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') 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') 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