From a9194650e6ae387be29aacfdf4b1b27a5c60ca34 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Sep 2017 18:57:46 +0300 Subject: Fix #5276 --- system/database/drivers/mysqli/mysqli_result.php | 14 +++----------- system/database/drivers/mysqli/mysqli_utility.php | 6 +----- 2 files changed, 4 insertions(+), 16 deletions(-) (limited to 'system/database/drivers') diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index 0b3d9c2b4..bd465c405 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -130,10 +130,10 @@ class CI_DB_mysqli_result extends CI_DB_result { * mysqli_result::fetch_fields() * * @used-by CI_DB_mysqli_result::field_data() - * @param int $flags + * @param int $type * @return string */ - private static function _get_field_type($flags) + private static function _get_field_type($type) { static $map; isset($map) OR $map = array( @@ -164,15 +164,7 @@ class CI_DB_mysqli_result extends CI_DB_result { MYSQLI_TYPE_GEOMETRY => 'geometry' ); - foreach ($map as $flag => $name) - { - if ($flags & $flag) - { - return $name; - } - } - - return $flags; + return isset($map[$type]) ? $map[$type] : $type; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php index 1699b611f..82cf5cebf 100644 --- a/system/database/drivers/mysqli/mysqli_utility.php +++ b/system/database/drivers/mysqli/mysqli_utility.php @@ -155,11 +155,7 @@ class CI_DB_mysqli_utility extends CI_DB_utility { while ($field = $query->result_id->fetch_field()) { // Most versions of MySQL store timestamp as a string - $is_int[$i] = ($field->type & MYSQLI_TYPE_TINY) - OR ($field->type & MYSQLI_TYPE_SHORT) - OR ($field->type & MYSQLI_TYPE_INT24) - OR ($field->type & MYSQLI_TYPE_LONG) - OR ($field->type & MYSQLI_TYPE_LONGLONG); + $is_int[$i] = in_array($field->type, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_INT24, MYSQLI_TYPE_LONG), TRUE); // Create a string of field names $field_str .= $this->db->escape_identifiers($field->name).', '; -- cgit v1.2.3-24-g4f1b