diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 18398b64b74..75e19e91e13 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1424,7 +1424,7 @@ public function escape_identifiers($item) return $item; } // Avoid breaking functions and literal values inside queries - elseif (ctype_digit($item) OR $item[0] === "'" OR ($this->_escape_char !== '"' && $item[0] === '"') OR strpos($item, '(') !== FALSE) + elseif (ctype_digit((string) $item) OR $item[0] === "'" OR ($this->_escape_char !== '"' && $item[0] === '"') OR strpos($item, '(') !== FALSE) { return $item; } diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 3ff7f40c991..e91612d84af 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -2717,7 +2717,7 @@ protected function _is_literal($str) { $str = trim($str); - if (empty($str) OR ctype_digit($str) OR (string) (float) $str === $str OR in_array(strtoupper($str), array('TRUE', 'FALSE'), TRUE)) + if (empty($str) OR ctype_digit((string) $str) OR (string) (float) $str === $str OR in_array(strtoupper($str), array('TRUE', 'FALSE'), TRUE)) { return TRUE; } diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 7bb43b5be8e..0ce8252cf1a 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -179,7 +179,7 @@ public function __construct($params) return; } elseif ($this->hostname !== '' && strpos($this->hostname, '/') === FALSE && strpos($this->hostname, ':') === FALSE - && (( ! empty($this->port) && ctype_digit($this->port)) OR $this->database !== '')) + && (( ! empty($this->port) && ctype_digit((string) $this->port)) OR $this->database !== '')) { /* If the hostname field isn't empty, doesn't contain * ':' and/or '/' and if port and/or database aren't @@ -189,7 +189,7 @@ public function __construct($params) * that the database field is a service name. */ $this->dsn = $this->hostname - .(( ! empty($this->port) && ctype_digit($this->port)) ? ':'.$this->port : '') + .(( ! empty($this->port) && ctype_digit((string) $this->port)) ? ':'.$this->port : '') .($this->database !== '' ? '/'.ltrim($this->database, '/') : ''); if (preg_match($valid_dsns['ec'], $this->dsn)) diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 15d800b46fd..0cbd1f45715 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -95,7 +95,7 @@ protected function _build_dsn() $this->hostname === '' OR $this->dsn = 'host='.$this->hostname.' '; - if ( ! empty($this->port) && ctype_digit($this->port)) + if ( ! empty($this->port) && ctype_digit((string) $this->port)) { $this->dsn .= 'port='.$this->port.' '; } diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 024f0ed6260..eeb83b99f0c 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1211,7 +1211,7 @@ public function valid_url($str) // Apparently, FILTER_VALIDATE_URL doesn't reject digit-only names for some reason ... // See https://github.com/bcit-ci/CodeIgniter/issues/5755 - if (ctype_digit($str)) + if (ctype_digit((string) $str)) { return FALSE; } diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index ea8c56d01be..4c8994c96e1 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -638,7 +638,7 @@ public function initialize($props = array()) // Set the quality $this->quality = trim(str_replace('%', '', $this->quality)); - if ($this->quality === '' OR $this->quality === 0 OR ! ctype_digit($this->quality)) + if ($this->quality === '' OR $this->quality === 0 OR ! ctype_digit((string) $this->quality)) { $this->quality = 90; } diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php index a211ce31bf9..03f61e8df9c 100644 --- a/system/libraries/Session/Session.php +++ b/system/libraries/Session/Session.php @@ -392,7 +392,7 @@ protected function _configure_sid_length() if (PHP_VERSION_ID < 70100) { $hash_function = ini_get('session.hash_function'); - if (ctype_digit($hash_function)) + if (ctype_digit((string) $hash_function)) { if ($hash_function !== '1') {