Skip to content

Commit a9259af

Browse files
committed
Cast variables to string for ctype_digit
1 parent 3658d73 commit a9259af

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

system/database/DB_driver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ public function escape_identifiers($item, $split = TRUE)
13481348
return $item;
13491349
}
13501350
// Avoid breaking functions and literal values inside queries
1351-
elseif (ctype_digit($item) OR $item[0] === "'" OR ($this->_escape_char !== '"' && $item[0] === '"') OR strpos($item, '(') !== FALSE)
1351+
elseif (ctype_digit((string) $item) OR $item[0] === "'" OR ($this->_escape_char !== '"' && $item[0] === '"') OR strpos($item, '(') !== FALSE)
13521352
{
13531353
return $item;
13541354
}

system/database/DB_query_builder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2782,7 +2782,7 @@ protected function _is_literal($str)
27822782
{
27832783
$str = trim($str);
27842784

2785-
if (empty($str) OR ctype_digit($str) OR (string) (float) $str === $str OR in_array(strtoupper($str), array('TRUE', 'FALSE'), TRUE))
2785+
if (empty($str) OR ctype_digit((string) $str) OR (string) (float) $str === $str OR in_array(strtoupper($str), array('TRUE', 'FALSE'), TRUE))
27862786
{
27872787
return TRUE;
27882788
}

system/database/drivers/oci8/oci8_driver.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function __construct($params)
177177
return;
178178
}
179179
elseif ($this->hostname !== '' && strpos($this->hostname, '/') === FALSE && strpos($this->hostname, ':') === FALSE
180-
&& (( ! empty($this->port) && ctype_digit($this->port)) OR $this->database !== ''))
180+
&& (( ! empty($this->port) && ctype_digit((string) $this->port)) OR $this->database !== ''))
181181
{
182182
/* If the hostname field isn't empty, doesn't contain
183183
* ':' and/or '/' and if port and/or database aren't
@@ -187,7 +187,7 @@ public function __construct($params)
187187
* that the database field is a service name.
188188
*/
189189
$this->dsn = $this->hostname
190-
.(( ! empty($this->port) && ctype_digit($this->port)) ? ':'.$this->port : '')
190+
.(( ! empty($this->port) && ctype_digit((string) $this->port)) ? ':'.$this->port : '')
191191
.($this->database !== '' ? '/'.ltrim($this->database, '/') : '');
192192

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

system/database/drivers/postgre/postgre_driver.php

+1-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ public function valid_url($str)
12121212

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

system/libraries/Image_lib.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ public function initialize($props = array())
631631
// Set the quality
632632
$this->quality = trim(str_replace('%', '', $this->quality));
633633

634-
if ($this->quality === '' OR $this->quality === 0 OR ! ctype_digit($this->quality))
634+
if ($this->quality === '' OR $this->quality === 0 OR ! ctype_digit((string) $this->quality))
635635
{
636636
$this->quality = 90;
637637
}

system/libraries/Session/Session.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ protected function _configure_sid_length()
390390
if (PHP_VERSION_ID < 70100)
391391
{
392392
$hash_function = ini_get('session.hash_function');
393-
if (ctype_digit($hash_function))
393+
if (ctype_digit((string) $hash_function))
394394
{
395395
if ($hash_function !== '1')
396396
{

0 commit comments

Comments
 (0)