diff --git a/system/core/Model.php b/system/core/Model.php index b2bbbd4d484..5ca24e0a46f 100644 --- a/system/core/Model.php +++ b/system/core/Model.php @@ -47,6 +47,7 @@ * @author EllisLab Dev Team * @link https://codeigniter.com/userguide3/libraries/config.html */ +#[AllowDynamicProperties] class CI_Model { /** diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index e91612d84af..661324c0909 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -533,6 +533,10 @@ public function from($from) */ public function join($table, $cond, $type = '', $escape = NULL) { + $type = (string) $type; + $cond = (string) $cond; + $table = (string) $table; + if ($type !== '') { $type = strtoupper(trim($type)); @@ -1208,6 +1212,9 @@ public function or_having($key, $value = NULL, $escape = NULL) */ public function order_by($orderby, $direction = '', $escape = NULL) { + $orderby = (string) $orderby; + $direction = (string) $direction; + $direction = strtoupper(trim($direction)); if ($direction === 'RANDOM') diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index 8c4f94d18fe..65950552f2b 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -137,33 +137,39 @@ public function field_data() private static function _get_field_type($type) { static $map; - isset($map) OR $map = array( - MYSQLI_TYPE_DECIMAL => 'decimal', - MYSQLI_TYPE_BIT => 'bit', - MYSQLI_TYPE_TINY => 'tinyint', - MYSQLI_TYPE_SHORT => 'smallint', - MYSQLI_TYPE_INT24 => 'mediumint', - MYSQLI_TYPE_LONG => 'int', - MYSQLI_TYPE_LONGLONG => 'bigint', - MYSQLI_TYPE_FLOAT => 'float', - MYSQLI_TYPE_DOUBLE => 'double', - MYSQLI_TYPE_TIMESTAMP => 'timestamp', - MYSQLI_TYPE_DATE => 'date', - MYSQLI_TYPE_TIME => 'time', - MYSQLI_TYPE_DATETIME => 'datetime', - MYSQLI_TYPE_YEAR => 'year', - MYSQLI_TYPE_NEWDATE => 'date', - MYSQLI_TYPE_INTERVAL => 'interval', - MYSQLI_TYPE_ENUM => 'enum', - MYSQLI_TYPE_SET => 'set', - MYSQLI_TYPE_TINY_BLOB => 'tinyblob', - MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob', - MYSQLI_TYPE_BLOB => 'blob', - MYSQLI_TYPE_LONG_BLOB => 'longblob', - MYSQLI_TYPE_STRING => 'char', - MYSQLI_TYPE_VAR_STRING => 'varchar', - MYSQLI_TYPE_GEOMETRY => 'geometry' - ); + + if (!isset($map)) { + $map = array( + MYSQLI_TYPE_DECIMAL => 'decimal', + MYSQLI_TYPE_BIT => 'bit', + MYSQLI_TYPE_TINY => 'tinyint', + MYSQLI_TYPE_SHORT => 'smallint', + MYSQLI_TYPE_INT24 => 'mediumint', + MYSQLI_TYPE_LONG => 'int', + MYSQLI_TYPE_LONGLONG => 'bigint', + MYSQLI_TYPE_FLOAT => 'float', + MYSQLI_TYPE_DOUBLE => 'double', + MYSQLI_TYPE_TIMESTAMP => 'timestamp', + MYSQLI_TYPE_DATE => 'date', + MYSQLI_TYPE_TIME => 'time', + MYSQLI_TYPE_DATETIME => 'datetime', + MYSQLI_TYPE_YEAR => 'year', + MYSQLI_TYPE_NEWDATE => 'date', + MYSQLI_TYPE_ENUM => 'enum', + MYSQLI_TYPE_SET => 'set', + MYSQLI_TYPE_TINY_BLOB => 'tinyblob', + MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob', + MYSQLI_TYPE_BLOB => 'blob', + MYSQLI_TYPE_LONG_BLOB => 'longblob', + MYSQLI_TYPE_STRING => 'char', + MYSQLI_TYPE_VAR_STRING => 'varchar', + MYSQLI_TYPE_GEOMETRY => 'geometry' + ); + + if (defined('MYSQLI_TYPE_INTERVAL')) { + $map[constant('MYSQLI_TYPE_INTERVAL')] = 'interval'; + } + } return isset($map[$type]) ? $map[$type] : $type; } diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php index 54d1aa99e49..80154fbb456 100644 --- a/system/libraries/Encryption.php +++ b/system/libraries/Encryption.php @@ -475,6 +475,8 @@ protected function _openssl_encrypt($data, $params) return FALSE; } + $data = (string) $data; + $iv = ($iv_size = openssl_cipher_iv_length($params['handle'])) ? $this->create_key($iv_size) : ''; @@ -626,6 +628,13 @@ protected function _mcrypt_decrypt($data, $params) */ protected function _openssl_decrypt($data, $params) { + if (empty($params['handle'])) + { + return FALSE; + } + + $data = (string) $data; + if ($iv_size = openssl_cipher_iv_length($params['handle'])) { $iv = self::substr($data, 0, $iv_size); @@ -636,15 +645,13 @@ protected function _openssl_decrypt($data, $params) $iv = ''; } - return empty($params['handle']) - ? FALSE - : openssl_decrypt( - $data, - $params['handle'], - $params['key'], - 1, // DO NOT TOUCH! - $iv - ); + return openssl_decrypt( + $data, + $params['handle'], + $params['key'], + 1, // DO NOT TOUCH! + $iv + ); } // --------------------------------------------------------------------