diff options
-rw-r--r-- | application/config/mimes.php | 4 | ||||
-rw-r--r-- | system/core/Common.php | 2 | ||||
-rw-r--r-- | system/database/DB_driver.php | 12 | ||||
-rw-r--r-- | system/helpers/captcha_helper.php | 12 | ||||
-rw-r--r-- | system/libraries/Cache/drivers/Cache_redis.php | 27 | ||||
-rw-r--r-- | system/libraries/Session/drivers/Session_files_driver.php | 4 | ||||
-rw-r--r-- | system/libraries/Upload.php | 4 | ||||
-rw-r--r-- | system/libraries/Zip.php | 3 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 16 | ||||
-rw-r--r-- | user_guide_src/source/database/db_driver_reference.rst | 7 | ||||
-rw-r--r-- | user_guide_src/source/database/forge.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/installation/upgrade_3112.rst | 6 |
12 files changed, 86 insertions, 13 deletions
diff --git a/application/config/mimes.php b/application/config/mimes.php index 7aa5c9e4e..88a621a19 100644 --- a/application/config/mimes.php +++ b/application/config/mimes.php @@ -5,7 +5,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | ------------------------------------------------------------------- | MIME TYPES | ------------------------------------------------------------------- -| This file contains an array of mime types. It is used by the +| This file contains an array of mime types. It is used by the | Upload class to help identify allowed file types. | */ @@ -85,7 +85,7 @@ return array( 'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), 'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), 'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), - 'png' => array('image/png', 'image/x-png'), + 'png' => array('image/png', 'image/x-png'), 'tiff' => 'image/tiff', 'tif' => 'image/tiff', 'css' => array('text/css', 'text/plain'), diff --git a/system/core/Common.php b/system/core/Common.php index fadc0a0b1..f8ab7e800 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -569,7 +569,7 @@ if ( ! function_exists('set_status_header')) return; } - $server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2'), TRUE)) + $server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0'), TRUE)) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; header($server_protocol.' '.$code.' '.$text, TRUE, $code); } diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index b4f16b905..f3433f849 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -825,6 +825,18 @@ abstract class CI_DB_driver { { return $this->_trans_status; } + + // -------------------------------------------------------------------- + + /** + * Returns TRUE if a transaction is currently active + * + * @return bool + */ + public function trans_active() + { + return (bool) $this->_trans_depth; + } // -------------------------------------------------------------------- diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 642ff3a50..dcd6882c8 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -103,6 +103,18 @@ if ( ! function_exists('create_captcha')) return FALSE; } + if ($img_path === '' OR $img_url === '') + { + log_message('error', 'create_captcha(): $img_path and $img_url are required.'); + return FALSE; + } + + if ( ! is_dir($img_path) OR ! is_really_writable($img_path)) + { + log_message('error', "create_captcha(): '{$img_path}' is not a dir, nor is it writable."); + return FALSE; + } + if ($img_url !== '' OR $img_path !== '') { if ($img_path === '' OR $img_url === '') diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index 9dbe52844..9b082d11b 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -77,6 +77,13 @@ class CI_Cache_redis extends CI_Driver */ protected static $_delete_name; + /** + * sRem()/sRemove() method name depending on phpRedis version + * + * @var string + */ + protected static $_sRemove_name; + // ------------------------------------------------------------------------ /** @@ -98,9 +105,19 @@ class CI_Cache_redis extends CI_Driver return; } - isset(static::$_delete_name) OR static::$_delete_name = version_compare(phpversion('redis'), '5', '>=') - ? 'del' - : 'delete'; + if ( ! isset(static::$_delete_name, static::$_sRemove_name)) + { + if (version_compare(phpversion('redis'), '5', '>=')) + { + static::$_delete_name = 'del'; + static::$_sRemove_name = 'sRem'; + } + else + { + static::$_delete_name = 'delete'; + static::$_sRemove_name = 'sRemove'; + } + } $CI =& get_instance(); @@ -210,7 +227,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 TRUE; @@ -231,7 +248,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; } 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 diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 8c891cff6..95f765b78 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -867,7 +867,7 @@ class CI_Upload { $this->file_type = 'image/jpeg'; } - $img_mimes = array('image/gif', 'image/jpeg', 'image/png'); + $img_mimes = array('image/gif', 'image/jpeg', 'image/png', 'image/webp'); return in_array($this->file_type, $img_mimes, TRUE); } @@ -901,7 +901,7 @@ class CI_Upload { } // Images get some additional checks - if (in_array($ext, array('gif', 'jpg', 'jpeg', 'jpe', 'png'), TRUE) && @getimagesize($this->file_temp) === FALSE) + if (in_array($ext, array('gif', 'jpg', 'jpeg', 'jpe', 'png', 'webp'), TRUE) && @getimagesize($this->file_temp) === FALSE) { return FALSE; } diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 5fba1cf3a..4579e8c2b 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; } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index f5b68e08a..87fd6b9a8 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -135,6 +135,20 @@ Version 3.1.12 Release Date: Not Released +- General Changes + + - Improved logging of error conditions in :doc:`CAPTCHA Helper <helpers/captcha_helper>` function :php:func:`create_captcha()`. + - Added ``AUTO_INCREMENT`` support for Oracle 12.1+ to :doc:`Database Forge <database/forge>`. + - Added ``FULL [OUTER] JOIN`` support to :doc:`Query Builder <database/query_builder>`. + +Bug fixes for 3.1.12 +==================== + +- Fixed a bug (#5834) - :doc:`Query Builder <database/query_builder>` method ``count_all_results()`` triggered an SQL error for queries with a ``HAVING`` clause. +- Fixed a bug (#5840) - :doc:`Cache Library <libraries/caching>` 'redis' driver triggered an ``E_DEPRECATED`` warning about ``sRemove()`` with phpRedis 5. +- Fixed a bug (#5857) - :doc:`Session <libraries/sessions>` data could be corrupted after a concurrent request write with the 'files' driver due to a filesize cache being incorrect. +- Fixed a bug (#5861) - :doc:`Cache Library <libraries/caching>` 'redis' driver would always use phpRedis 5 ``del()`` due to an incorrect version check. +- Fixed a bug (#5879) - :doc:`Profiler Library <general/profiling>` triggered an ``E_DEPRECATED`` warning on PHP 7.4+. Version 3.1.11 ============== @@ -149,7 +163,7 @@ Release Date: Sep 19, 2019 - Updated the :doc:`Session <libraries/sessions>` and :doc:`Cache <libraries/caching>` libraries' 'redis' driver to work with phpRedis 5. Bug fixes for 3.1.11 -==================== +-------------------- - Fixed a bug (#5681) - :doc:`Database Forge <database/forge>` method ``modify_column()`` produced erroneous SQL for ``DEFAULT`` attribute changes under PostgreSQL, Firebird. - Fixed a bug (#5692) - :doc:`Database Forge <database/forge>` didn't handle column nullability with the 'oci8', 'pdo/oci' drivers. diff --git a/user_guide_src/source/database/db_driver_reference.rst b/user_guide_src/source/database/db_driver_reference.rst index c240526e0..ad53c2bfc 100644 --- a/user_guide_src/source/database/db_driver_reference.rst +++ b/user_guide_src/source/database/db_driver_reference.rst @@ -161,6 +161,13 @@ This article is intended to be a reference for them. Lets you retrieve the transaction status flag to determine if it has failed. + + .. php:method:: trans_active() + + :returns: TRUE if a transaction is active, FALSE if not + :rtype: bool + + Determines if a transaction is currently active. .. php:method:: compile_binds($sql, $binds) diff --git a/user_guide_src/source/database/forge.rst b/user_guide_src/source/database/forge.rst index 5af4f2248..c6cacb1b0 100644 --- a/user_guide_src/source/database/forge.rst +++ b/user_guide_src/source/database/forge.rst @@ -370,7 +370,7 @@ Class Reference .. php:method:: drop_column($table, $column_name) :param string $table: Table name - :param array $column_name: The column name to drop + :param string $column_name: The column name to drop :returns: TRUE on success, FALSE on failure :rtype: bool diff --git a/user_guide_src/source/installation/upgrade_3112.rst b/user_guide_src/source/installation/upgrade_3112.rst index 9c849d878..1000010ab 100644 --- a/user_guide_src/source/installation/upgrade_3112.rst +++ b/user_guide_src/source/installation/upgrade_3112.rst @@ -12,3 +12,9 @@ Replace all files and directories in your *system/* directory. .. note:: If you have any custom developed files in these directories, please make copies of them first. + +Step 2: Replace config/user_agents.php +================================ + +This config file has received some updates. Please copy it to +*application/config/user_agents.php*. |