Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/core/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
8 changes: 4 additions & 4 deletions system/core/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function &is_loaded($class = '')

if ($class !== '')
{
$_is_loaded[strtolower($class)] = $class;
$_is_loaded[strtolower((string) $class)] = $class;
}

return $_is_loaded;
Expand Down Expand Up @@ -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;
}

Expand Down
12 changes: 6 additions & 6 deletions system/core/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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]))
{
Expand All @@ -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');
}

// --------------------------------------------------------------------
Expand Down
20 changes: 10 additions & 10 deletions system/core/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down Expand Up @@ -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];
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -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];
}
Expand Down
2 changes: 1 addition & 1 deletion system/core/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]]))
Expand Down
2 changes: 1 addition & 1 deletion system/core/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion system/core/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) {
Expand Down
2 changes: 1 addition & 1 deletion system/core/Utf8.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion system/core/compat/hash.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion system/database/DB_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
4 changes: 2 additions & 2 deletions system/database/DB_query_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')))
{
Expand Down Expand Up @@ -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))
{
Expand Down
2 changes: 1 addition & 1 deletion system/database/drivers/cubrid/cubrid_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion system/database/drivers/ibase/ibase_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions system/database/drivers/mssql/mssql_driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

// --------------------------------------------------------------------
Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion system/database/drivers/mssql/mssql_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion system/helpers/form_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<form action="'.$action.'"'.$attributes.">\n";
Expand Down
2 changes: 1 addition & 1 deletion system/helpers/inflector_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function underscore($str)
*/
function humanize($str, $separator = '_')
{
return ucwords(preg_replace('/['.preg_quote($separator).']+/', ' ', trim(MB_ENABLED ? mb_strtolower($str) : strtolower($str))));
return ucwords(preg_replace('/['.preg_quote($separator).']+/', ' ', trim(MB_ENABLED ? mb_strtolower((string) $str) : strtolower((string) $str))));
}
}

Expand Down
18 changes: 9 additions & 9 deletions system/libraries/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ protected function _mcrypt_initialize($params)
{
if ( ! empty($params['cipher']))
{
$params['cipher'] = strtolower($params['cipher']);
$params['cipher'] = strtolower((string) $params['cipher']);
$this->_cipher_alias($params['cipher']);

if ( ! in_array($params['cipher'], mcrypt_list_algorithms(), TRUE))
{
log_message('error', 'Encryption: MCrypt cipher '.strtoupper($params['cipher']).' is not available.');
log_message('error', 'Encryption: MCrypt cipher '.strtoupper((string) $params['cipher']).' is not available.');
}
else
{
Expand All @@ -244,10 +244,10 @@ protected function _mcrypt_initialize($params)

if ( ! empty($params['mode']))
{
$params['mode'] = strtolower($params['mode']);
$params['mode'] = strtolower((string) $params['mode']);
if ( ! isset($this->_modes['mcrypt'][$params['mode']]))
{
log_message('error', 'Encryption: MCrypt mode '.strtoupper($params['mode']).' is not available.');
log_message('error', 'Encryption: MCrypt mode '.strtoupper((string) $params['mode']).' is not available.');
}
else
{
Expand All @@ -267,11 +267,11 @@ protected function _mcrypt_initialize($params)

if ($this->_handle = mcrypt_module_open($this->_cipher, '', $this->_mode, ''))
{
log_message('info', 'Encryption: MCrypt cipher '.strtoupper($this->_cipher).' initialized in '.strtoupper($this->_mode).' mode.');
log_message('info', 'Encryption: MCrypt cipher '.strtoupper((string) $this->_cipher).' initialized in '.strtoupper((string) $this->_mode).' mode.');
}
else
{
log_message('error', 'Encryption: Unable to initialize MCrypt with cipher '.strtoupper($this->_cipher).' in '.strtoupper($this->_mode).' mode.');
log_message('error', 'Encryption: Unable to initialize MCrypt with cipher '.strtoupper((string) $this->_cipher).' in '.strtoupper((string) $this->_mode).' mode.');
}
}
}
Expand All @@ -298,7 +298,7 @@ protected function _openssl_initialize($params)
$params['mode'] = strtolower($params['mode']);
if ( ! isset($this->_modes['openssl'][$params['mode']]))
{
log_message('error', 'Encryption: OpenSSL mode '.strtoupper($params['mode']).' is not available.');
log_message('error', 'Encryption: OpenSSL mode '.strtoupper((string) $params['mode']).' is not available.');
}
else
{
Expand All @@ -316,12 +316,12 @@ protected function _openssl_initialize($params)
if ( ! in_array($handle, openssl_get_cipher_methods(), TRUE))
{
$this->_handle = NULL;
log_message('error', 'Encryption: Unable to initialize OpenSSL with method '.strtoupper($handle).'.');
log_message('error', 'Encryption: Unable to initialize OpenSSL with method '.strtoupper((string) $handle).'.');
}
else
{
$this->_handle = $handle;
log_message('info', 'Encryption: OpenSSL initialized with method '.strtoupper($handle).'.');
log_message('info', 'Encryption: OpenSSL initialized with method '.strtoupper((string) $handle).'.');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion system/libraries/Form_validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ public function valid_url($str)
{
return FALSE;
}
elseif ( ! in_array(strtolower($matches[1]), array('http', 'https'), TRUE))
elseif ( ! in_array(strtolower((string) $matches[1]), array('http', 'https'), TRUE))
{
return FALSE;
}
Expand Down
8 changes: 4 additions & 4 deletions system/libraries/Image_lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1181,8 +1181,8 @@ public function overlay_watermark()
// invert the offset. Same with the horizontal
// offset when the image is at the right

$this->wm_vrt_alignment = strtoupper($this->wm_vrt_alignment[0]);
$this->wm_hor_alignment = strtoupper($this->wm_hor_alignment[0]);
$this->wm_vrt_alignment = strtoupper((string) $this->wm_vrt_alignment[0]);
$this->wm_hor_alignment = strtoupper((string) $this->wm_hor_alignment[0]);

if ($this->wm_vrt_alignment === 'B')
$this->wm_vrt_offset = $this->wm_vrt_offset * -1;
Expand Down Expand Up @@ -1340,8 +1340,8 @@ public function text_watermark()
$this->wm_shadow_distance = 0;
}

$this->wm_vrt_alignment = strtoupper($this->wm_vrt_alignment[0]);
$this->wm_hor_alignment = strtoupper($this->wm_hor_alignment[0]);
$this->wm_vrt_alignment = strtoupper((string) $this->wm_vrt_alignment[0]);
$this->wm_hor_alignment = strtoupper((string) $this->wm_hor_alignment[0]);

// Set vertical alignment
if ($this->wm_vrt_alignment === 'M')
Expand Down
2 changes: 1 addition & 1 deletion system/libraries/Javascript.php
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ public function inline($script, $cdata = TRUE)
*/
protected function _open_script($src = '')
{
return '<script type="text/javascript" charset="'.strtolower($this->CI->config->item('charset')).'"'
return '<script type="text/javascript" charset="'.strtolower((string) $this->CI->config->item('charset')).'"'
.($src === '' ? '>' : ' src="'.$src.'">');
}

Expand Down
2 changes: 1 addition & 1 deletion system/libraries/Trackback.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function receive()
return FALSE;
}

$this->data['charset'] = isset($_POST['charset']) ? strtoupper(trim($_POST['charset'])) : 'auto';
$this->data['charset'] = isset($_POST['charset']) ? strtoupper(trim((string) $_POST['charset'])) : 'auto';

if ($val !== 'url' && MB_ENABLED === TRUE)
{
Expand Down
Loading