Skip to content

Commit 84f0752

Browse files
committed
Cast variables to string for ctype_digit
1 parent b6ed28d commit 84f0752

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

system/database/DB_driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ public function escape_identifiers($item)
14241424
return $item;
14251425
}
14261426
// Avoid breaking functions and literal values inside queries
1427-
elseif (ctype_digit($item) OR $item[0] === "'" OR ($this->_escape_char !== '"' && $item[0] === '"') OR strpos($item, '(') !== FALSE)
1427+
elseif (ctype_digit((string) $item) OR $item[0] === "'" OR ($this->_escape_char !== '"' && $item[0] === '"') OR strpos($item, '(') !== FALSE)
14281428
{
14291429
return $item;
14301430
}

system/database/DB_query_builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,7 @@ protected function _is_literal($str)
27172717
{
27182718
$str = trim($str);
27192719

2720-
if (empty($str) OR ctype_digit($str) OR (string) (float) $str === $str OR in_array(strtoupper($str), array('TRUE', 'FALSE'), TRUE))
2720+
if (empty($str) OR ctype_digit((string) $str) OR (string) (float) $str === $str OR in_array(strtoupper($str), array('TRUE', 'FALSE'), TRUE))
27212721
{
27222722
return TRUE;
27232723
}

system/database/drivers/oci8/oci8_driver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function __construct($params)
179179
return;
180180
}
181181
elseif ($this->hostname !== '' && strpos($this->hostname, '/') === FALSE && strpos($this->hostname, ':') === FALSE
182-
&& (( ! empty($this->port) && ctype_digit($this->port)) OR $this->database !== ''))
182+
&& (( ! empty($this->port) && ctype_digit((string) $this->port)) OR $this->database !== ''))
183183
{
184184
/* If the hostname field isn't empty, doesn't contain
185185
* ':' and/or '/' and if port and/or database aren't
@@ -189,7 +189,7 @@ public function __construct($params)
189189
* that the database field is a service name.
190190
*/
191191
$this->dsn = $this->hostname
192-
.(( ! empty($this->port) && ctype_digit($this->port)) ? ':'.$this->port : '')
192+
.(( ! empty($this->port) && ctype_digit((string) $this->port)) ? ':'.$this->port : '')
193193
.($this->database !== '' ? '/'.ltrim($this->database, '/') : '');
194194

195195
if (preg_match($valid_dsns['ec'], $this->dsn))

system/database/drivers/postgre/postgre_driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected function _build_dsn()
9595

9696
$this->hostname === '' OR $this->dsn = 'host='.$this->hostname.' ';
9797

98-
if ( ! empty($this->port) && ctype_digit($this->port))
98+
if ( ! empty($this->port) && ctype_digit((string) $this->port))
9999
{
100100
$this->dsn .= 'port='.$this->port.' ';
101101
}

system/libraries/Form_validation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ public function valid_url($str)
12111211

12121212
// Apparently, FILTER_VALIDATE_URL doesn't reject digit-only names for some reason ...
12131213
// See https://github.com/bcit-ci/CodeIgniter/issues/5755
1214-
if (ctype_digit($str))
1214+
if (ctype_digit((string) $str))
12151215
{
12161216
return FALSE;
12171217
}

system/libraries/Image_lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ public function initialize($props = array())
638638
// Set the quality
639639
$this->quality = trim(str_replace('%', '', $this->quality));
640640

641-
if ($this->quality === '' OR $this->quality === 0 OR ! ctype_digit($this->quality))
641+
if ($this->quality === '' OR $this->quality === 0 OR ! ctype_digit((string) $this->quality))
642642
{
643643
$this->quality = 90;
644644
}

system/libraries/Session/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ protected function _configure_sid_length()
392392
if (PHP_VERSION_ID < 70100)
393393
{
394394
$hash_function = ini_get('session.hash_function');
395-
if (ctype_digit($hash_function))
395+
if (ctype_digit((string) $hash_function))
396396
{
397397
if ($hash_function !== '1')
398398
{

0 commit comments

Comments
 (0)