Skip to content

Commit 500edd1

Browse files
authored
Merge pull request #13 from NielBuys/tasks/Issues_From_Other_Forks
Issues merged from different forks.
2 parents 093acc3 + f8f186b commit 500edd1

4 files changed

Lines changed: 57 additions & 36 deletions

File tree

system/core/Model.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
* @author EllisLab Dev Team
4848
* @link https://codeigniter.com/userguide3/libraries/config.html
4949
*/
50+
#[AllowDynamicProperties]
5051
class CI_Model {
5152

5253
/**

system/database/DB_query_builder.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ public function from($from)
533533
*/
534534
public function join($table, $cond, $type = '', $escape = NULL)
535535
{
536+
$type = (string) $type;
537+
$cond = (string) $cond;
538+
$table = (string) $table;
539+
536540
if ($type !== '')
537541
{
538542
$type = strtoupper(trim($type));
@@ -1208,6 +1212,9 @@ public function or_having($key, $value = NULL, $escape = NULL)
12081212
*/
12091213
public function order_by($orderby, $direction = '', $escape = NULL)
12101214
{
1215+
$orderby = (string) $orderby;
1216+
$direction = (string) $direction;
1217+
12111218
$direction = strtoupper(trim($direction));
12121219

12131220
if ($direction === 'RANDOM')

system/database/drivers/mysqli/mysqli_result.php

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -137,33 +137,39 @@ public function field_data()
137137
private static function _get_field_type($type)
138138
{
139139
static $map;
140-
isset($map) OR $map = array(
141-
MYSQLI_TYPE_DECIMAL => 'decimal',
142-
MYSQLI_TYPE_BIT => 'bit',
143-
MYSQLI_TYPE_TINY => 'tinyint',
144-
MYSQLI_TYPE_SHORT => 'smallint',
145-
MYSQLI_TYPE_INT24 => 'mediumint',
146-
MYSQLI_TYPE_LONG => 'int',
147-
MYSQLI_TYPE_LONGLONG => 'bigint',
148-
MYSQLI_TYPE_FLOAT => 'float',
149-
MYSQLI_TYPE_DOUBLE => 'double',
150-
MYSQLI_TYPE_TIMESTAMP => 'timestamp',
151-
MYSQLI_TYPE_DATE => 'date',
152-
MYSQLI_TYPE_TIME => 'time',
153-
MYSQLI_TYPE_DATETIME => 'datetime',
154-
MYSQLI_TYPE_YEAR => 'year',
155-
MYSQLI_TYPE_NEWDATE => 'date',
156-
MYSQLI_TYPE_INTERVAL => 'interval',
157-
MYSQLI_TYPE_ENUM => 'enum',
158-
MYSQLI_TYPE_SET => 'set',
159-
MYSQLI_TYPE_TINY_BLOB => 'tinyblob',
160-
MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob',
161-
MYSQLI_TYPE_BLOB => 'blob',
162-
MYSQLI_TYPE_LONG_BLOB => 'longblob',
163-
MYSQLI_TYPE_STRING => 'char',
164-
MYSQLI_TYPE_VAR_STRING => 'varchar',
165-
MYSQLI_TYPE_GEOMETRY => 'geometry'
166-
);
140+
141+
if (!isset($map)) {
142+
$map = array(
143+
MYSQLI_TYPE_DECIMAL => 'decimal',
144+
MYSQLI_TYPE_BIT => 'bit',
145+
MYSQLI_TYPE_TINY => 'tinyint',
146+
MYSQLI_TYPE_SHORT => 'smallint',
147+
MYSQLI_TYPE_INT24 => 'mediumint',
148+
MYSQLI_TYPE_LONG => 'int',
149+
MYSQLI_TYPE_LONGLONG => 'bigint',
150+
MYSQLI_TYPE_FLOAT => 'float',
151+
MYSQLI_TYPE_DOUBLE => 'double',
152+
MYSQLI_TYPE_TIMESTAMP => 'timestamp',
153+
MYSQLI_TYPE_DATE => 'date',
154+
MYSQLI_TYPE_TIME => 'time',
155+
MYSQLI_TYPE_DATETIME => 'datetime',
156+
MYSQLI_TYPE_YEAR => 'year',
157+
MYSQLI_TYPE_NEWDATE => 'date',
158+
MYSQLI_TYPE_ENUM => 'enum',
159+
MYSQLI_TYPE_SET => 'set',
160+
MYSQLI_TYPE_TINY_BLOB => 'tinyblob',
161+
MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob',
162+
MYSQLI_TYPE_BLOB => 'blob',
163+
MYSQLI_TYPE_LONG_BLOB => 'longblob',
164+
MYSQLI_TYPE_STRING => 'char',
165+
MYSQLI_TYPE_VAR_STRING => 'varchar',
166+
MYSQLI_TYPE_GEOMETRY => 'geometry'
167+
);
168+
169+
if (defined('MYSQLI_TYPE_INTERVAL')) {
170+
$map[constant('MYSQLI_TYPE_INTERVAL')] = 'interval';
171+
}
172+
}
167173

168174
return isset($map[$type]) ? $map[$type] : $type;
169175
}

system/libraries/Encryption.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,8 @@ protected function _openssl_encrypt($data, $params)
475475
return FALSE;
476476
}
477477

478+
$data = (string) $data;
479+
478480
$iv = ($iv_size = openssl_cipher_iv_length($params['handle']))
479481
? $this->create_key($iv_size)
480482
: '';
@@ -626,6 +628,13 @@ protected function _mcrypt_decrypt($data, $params)
626628
*/
627629
protected function _openssl_decrypt($data, $params)
628630
{
631+
if (empty($params['handle']))
632+
{
633+
return FALSE;
634+
}
635+
636+
$data = (string) $data;
637+
629638
if ($iv_size = openssl_cipher_iv_length($params['handle']))
630639
{
631640
$iv = self::substr($data, 0, $iv_size);
@@ -636,15 +645,13 @@ protected function _openssl_decrypt($data, $params)
636645
$iv = '';
637646
}
638647

639-
return empty($params['handle'])
640-
? FALSE
641-
: openssl_decrypt(
642-
$data,
643-
$params['handle'],
644-
$params['key'],
645-
1, // DO NOT TOUCH!
646-
$iv
647-
);
648+
return openssl_decrypt(
649+
$data,
650+
$params['handle'],
651+
$params['key'],
652+
1, // DO NOT TOUCH!
653+
$iv
654+
);
648655
}
649656

650657
// --------------------------------------------------------------------

0 commit comments

Comments
 (0)