diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 93ceefa..5ad2c71 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -246,7 +246,7 @@ * in it's constructor, but it's _not_ class-specific. * */ - $charset = strtoupper(config_item('charset')); + $charset = strtoupper((string) config_item('charset')); ini_set('default_charset', $charset); if (extension_loaded('mbstring')) diff --git a/system/core/Common.php b/system/core/Common.php index 7081736..b434d7f 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -267,7 +267,7 @@ function &is_loaded($class = '') if ($class !== '') { - $_is_loaded[strtolower($class)] = $class; + $_is_loaded[strtolower((string) $class)] = $class; } return $_is_loaded; @@ -404,15 +404,15 @@ function &get_mimes() */ function is_https() { - if (! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { + if (! empty($_SERVER['HTTPS']) && strtolower((string) $_SERVER['HTTPS']) !== 'off') { return TRUE; } - if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https') { + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower((string) $_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https') { return TRUE; } - if (! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') { + if (! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower((string) $_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') { return TRUE; } diff --git a/system/core/Input.php b/system/core/Input.php index dacd7db..1df37c2 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -410,7 +410,7 @@ public function set_cookie($name, $value = '', $expire = '', $domain = '', $path isset($samesite) OR $samesite = config_item('cookie_samesite'); if (isset($samesite)) { - $samesite = ucfirst(strtolower($samesite)); + $samesite = ucfirst(strtolower((string) $samesite)); in_array($samesite, array('Lax', 'Strict', 'None'), TRUE) OR $samesite = 'Lax'; } else @@ -598,7 +598,7 @@ public function ip_address() */ public function valid_ip($ip, $which = '') { - switch (strtolower($which)) + switch (strtolower((string) $which)) { case 'ipv4': $which = FILTER_FLAG_IPV4; @@ -817,7 +817,7 @@ public function request_headers($xss_clean = FALSE) if (sscanf($key, 'HTTP_%s', $header) === 1) { // take SOME_HEADER and turn it into Some-Header - $header = str_replace('_', ' ', strtolower($header)); + $header = str_replace('_', ' ', strtolower((string) $header)); $header = str_replace(' ', '-', ucwords($header)); $this->headers[$header] = $_SERVER[$key]; @@ -848,11 +848,11 @@ public function get_request_header($index, $xss_clean = FALSE) empty($this->headers) && $this->request_headers(); foreach ($this->headers as $key => $value) { - $headers[strtolower($key)] = $value; + $headers[strtolower((string) $key)] = $value; } } - $index = strtolower($index); + $index = strtolower((string) $index); if ( ! isset($headers[$index])) { @@ -875,7 +875,7 @@ public function get_request_header($index, $xss_clean = FALSE) */ public function is_ajax_request() { - return ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); + return ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower((string) $_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); } // -------------------------------------------------------------------- diff --git a/system/core/Loader.php b/system/core/Loader.php index 6b03122..4ddb1a6 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -976,7 +976,7 @@ protected function _ci_load_library($class, $params = null, $object_name = null) if (class_exists($class, false)) { $property = $object_name; if (empty($property)) { - $property = strtolower($class); + $property = strtolower((string) $class); isset($this->_ci_varmap[$property]) && $property = $this->_ci_varmap[$property]; } @@ -1041,7 +1041,7 @@ protected function _ci_load_stock_library($library_name, $file_path, $params, $o $property = $object_name; if (empty($property)) { - $property = strtolower($library_name); + $property = strtolower((string) $library_name); isset($this->_ci_varmap[$property]) && $property = $this->_ci_varmap[$property]; } @@ -1120,21 +1120,21 @@ protected function _ci_init_library($class, $prefix, $config = false, $object_na // We test for both uppercase and lowercase, for servers that // are case-sensitive with regard to file names. Load global first, // override with environment next - if (file_exists($path . 'config/' . strtolower($class) . '.php')) { + if (file_exists($path . 'config/' . strtolower((string) $class) . '.php')) { include($path . 'config/' . strtolower($class) . '.php'); $found = true; - } elseif (file_exists($path . 'config/' . ucfirst(strtolower($class)) . '.php')) { - include($path . 'config/' . ucfirst(strtolower($class)) . '.php'); + } elseif (file_exists($path . 'config/' . ucfirst(strtolower((string) $class)) . '.php')) { + include($path . 'config/' . ucfirst(strtolower((string) $class)) . '.php'); $found = true; } - if (file_exists($path . 'config/' . ENVIRONMENT . '/' . strtolower($class) . '.php')) { - include($path . 'config/' . ENVIRONMENT . '/' . strtolower($class) . '.php'); + if (file_exists($path . 'config/' . ENVIRONMENT . '/' . strtolower((string) $class) . '.php')) { + include($path . 'config/' . ENVIRONMENT . '/' . strtolower((string) $class) . '.php'); $found = true; } elseif (file_exists( - $path . 'config/' . ENVIRONMENT . '/' . ucfirst(strtolower($class)) . '.php' + $path . 'config/' . ENVIRONMENT . '/' . ucfirst(strtolower((string) $class)) . '.php' )) { - include($path . 'config/' . ENVIRONMENT . '/' . ucfirst(strtolower($class)) . '.php'); + include($path . 'config/' . ENVIRONMENT . '/' . ucfirst(strtolower((string) $class)) . '.php'); $found = true; } @@ -1158,7 +1158,7 @@ protected function _ci_init_library($class, $prefix, $config = false, $object_na // Set the variable name we will assign the class to // Was a custom class name supplied? If so we'll use it if (empty($object_name)) { - $object_name = strtolower($class); + $object_name = strtolower((string) $class); if (isset($this->_ci_varmap[$object_name])) { $object_name = $this->_ci_varmap[$object_name]; } diff --git a/system/core/Log.php b/system/core/Log.php index ca3e38a..51251cf 100644 --- a/system/core/Log.php +++ b/system/core/Log.php @@ -175,7 +175,7 @@ public function write_log($level, $msg) return FALSE; } - $level = strtoupper($level); + $level = strtoupper((string) $level); if (( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) && ! isset($this->_threshold_array[$this->_levels[$level]])) diff --git a/system/core/Router.php b/system/core/Router.php index 3a25a5e..1458919 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -382,7 +382,7 @@ protected function _parse_routes() $uri = implode('/', $this->uri->segments); // Get HTTP verb - $http_verb = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : 'cli'; + $http_verb = isset($_SERVER['REQUEST_METHOD']) ? strtolower((string) $_SERVER['REQUEST_METHOD']) : 'cli'; // Loop through the route array looking for wildcards foreach ($this->routes as $key => $val) diff --git a/system/core/Security.php b/system/core/Security.php index 3733da5..a26776c 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -1013,7 +1013,7 @@ protected function _sanitize_naughty_html($matches) if (empty($matches['closeTag'])) { return '<' . $matches[1]; } // Is the element that we caught naughty? If so, escape it - elseif (in_array(strtolower($matches['tagName']), $naughty_tags, true)) { + elseif (in_array(strtolower((string) $matches['tagName']), $naughty_tags, true)) { return '<' . $matches[1] . '>'; } // For other tags, see if their attributes are "evil" and strip those elseif (isset($matches['attributes'])) { diff --git a/system/core/Utf8.php b/system/core/Utf8.php index 84a72ae..135eb8f 100644 --- a/system/core/Utf8.php +++ b/system/core/Utf8.php @@ -63,7 +63,7 @@ public function __construct() if ( defined('PREG_BAD_UTF8_ERROR') // PCRE must support UTF-8 && (ICONV_ENABLED === TRUE OR MB_ENABLED === TRUE) // iconv or mbstring must be installed - && strtoupper(config_item('charset')) === 'UTF-8' // Application charset must be UTF-8 + && strtoupper((string) config_item('charset')) === 'UTF-8' // Application charset must be UTF-8 ) { define('UTF8_ENABLED', TRUE); diff --git a/system/core/compat/hash.php b/system/core/compat/hash.php index 3fe3b85..311ba30 100644 --- a/system/core/compat/hash.php +++ b/system/core/compat/hash.php @@ -120,7 +120,7 @@ function hash_equals($known_string, $user_string) */ function hash_pbkdf2($algo, $password, $salt, $iterations, $length = 0, $raw_output = FALSE) { - if ( ! in_array(strtolower($algo), hash_algos(), TRUE)) + if ( ! in_array(strtolower((string) $algo), hash_algos(), TRUE)) { trigger_error('hash_pbkdf2(): Unknown hashing algorithm: '.$algo, E_USER_WARNING); return FALSE; diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index 64ccde0..329c9e8 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -777,7 +777,7 @@ protected function _process_fields($create_table = FALSE) if (isset($attributes['TYPE']) && ! empty($attributes['CONSTRAINT'])) { - switch (strtoupper($attributes['TYPE'])) + switch (strtoupper((string) $attributes['TYPE'])) { case 'ENUM': case 'SET': diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 3d9bcfb..e42aa82 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -406,7 +406,7 @@ protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX') $this->display_error('db_invalid_query'); } - $type = strtoupper($type); + $type = strtoupper((string) $type); if ( ! in_array($type, array('MAX', 'MIN', 'AVG', 'SUM'))) { @@ -535,7 +535,7 @@ public function join($table, $cond, $type = '', $escape = NULL) { if ($type !== '') { - $type = strtoupper(trim($type)); + $type = strtoupper(trim((string) $type)); if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER', 'FULL OUTER', 'FULL'), TRUE)) { diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php index e8e201f..0004b2f 100644 --- a/system/database/drivers/cubrid/cubrid_forge.php +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -169,7 +169,7 @@ protected function _process_column($field) */ protected function _attr_type(&$attributes) { - switch (strtoupper($attributes['TYPE'])) + switch (strtoupper((string) $attributes['TYPE'])) { case 'TINYINT': $attributes['TYPE'] = 'SMALLINT'; diff --git a/system/database/drivers/ibase/ibase_forge.php b/system/database/drivers/ibase/ibase_forge.php index 2c385f1..c5b5947 100644 --- a/system/database/drivers/ibase/ibase_forge.php +++ b/system/database/drivers/ibase/ibase_forge.php @@ -215,7 +215,7 @@ protected function _process_column($field) */ protected function _attr_type(&$attributes) { - switch (strtoupper($attributes['TYPE'])) + switch (strtoupper((string) $attributes['TYPE'])) { case 'TINYINT': $attributes['TYPE'] = 'SMALLINT'; diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 5012640..234235c 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -311,7 +311,7 @@ protected function _list_columns($table = '') { return 'SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns - WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper((string) $table)); } // -------------------------------------------------------------------- @@ -326,7 +326,7 @@ public function field_data($table) { $sql = 'SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, COLUMN_DEFAULT FROM INFORMATION_SCHEMA.Columns - WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper((string) $table)); if (($query = $this->query($sql)) === FALSE) { diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index f9dee91..1dd5694 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -119,7 +119,7 @@ protected function _attr_type(&$attributes) unset($attributes['CONSTRAINT']); } - switch (strtoupper($attributes['TYPE'])) + switch (strtoupper((string) $attributes['TYPE'])) { case 'MEDIUMINT': $attributes['TYPE'] = 'INTEGER'; diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index ba74ff5..c5cd6eb 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -86,7 +86,7 @@ function form_open($action = '', $attributes = array(), $hidden = array()) if (stripos($attributes, 'accept-charset=') === FALSE) { - $attributes .= ' accept-charset="'.strtolower(config_item('charset')).'"'; + $attributes .= ' accept-charset="'.strtolower((string) config_item('charset')).'"'; } $form = '