Skip to content

Commit b2c71d6

Browse files
committed
fix: properly cast to string
Signed-off-by: otengkwame <developerkwame@gmail.com>
1 parent 6b37876 commit b2c71d6

6 files changed

Lines changed: 7 additions & 5 deletions

File tree

CodeIgniter/Framework/core/Lang.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ public function use($langfile, $idiom = '', $return = false, $add_suffix = true,
192192
*/
193193
public function line($line, $log_errors = true)
194194
{
195+
$line = (string) $line;
196+
195197
$value = isset($this->language[$line]) ? $this->language[$line] : false;
196198

197199
// Because killer robots like unicorns!

CodeIgniter/Framework/database/DB_query_builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2507,7 +2507,7 @@ protected function _is_literal(string $str): bool
25072507
{
25082508
$str = trim($str);
25092509

2510-
if (empty($str) or ctype_digit($str) or (string) (float) $str === $str or in_array(strtoupper($str), ['TRUE', 'FALSE'], true)) {
2510+
if (empty($str) or ctype_digit((string) $str) or (string) (float) $str === $str or in_array(strtoupper($str), ['TRUE', 'FALSE'], true)) {
25112511
return true;
25122512
}
25132513

CodeIgniter/Framework/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
$this->dsn .= 'port=' . $this->port . ' ';
100100
}
101101

CodeIgniter/Framework/libraries/Image_lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ public function initialize($props = [])
610610
// Set the quality
611611
$this->quality = trim(str_replace('%', '', $this->quality));
612612

613-
if ($this->quality === '' or $this->quality === 0 or ! ctype_digit($this->quality)) {
613+
if ($this->quality === '' or $this->quality === 0 or ! ctype_digit((string) $this->quality)) {
614614
$this->quality = 90;
615615
}
616616

CodeIgniter/Framework/libraries/Pagination.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ public function create_links()
508508

509509
// If something isn't quite right, back to the default base page.
510510
// A fix for this is below [if ( ! ctype_digit($this->cur_page) OR ($this->use_page_numbers && (int) $this->cur_page === 0))
511-
if (! ctype_digit((string)$this->cur_page) or ($this->use_page_numbers && (int) $this->cur_page === 0)) {
511+
if (! ctype_digit((string) $this->cur_page) or ($this->use_page_numbers && (int) $this->cur_page === 0)) {
512512
$this->cur_page = $base_page;
513513
} else {
514514
// Make sure we're using integers for comparisons later.

CodeIgniter/Framework/libraries/Trackback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ public function get_id($url): string|bool
387387
}
388388
}
389389

390-
return ctype_digit($tb_id) ? $tb_id : false;
390+
return ctype_digit((string) $tb_id) ? $tb_id : false;
391391
}
392392

393393
// --------------------------------------------------------------------

0 commit comments

Comments
 (0)