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 helpers/html_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function html_tag($tag, $attr = array(), $content = false)
$html .= (!empty($attr)) ? ' ' . (is_array($attr) ? arrayToAttributes($attr) : $attr) : '';

// a void element?
if (in_array(mb_strtolower($tag), $void_elements)) {
if (in_array(mb_strtolower((string) $tag), $void_elements)) {
// these can not have content
$html .= ' />';
} else {
Expand Down
4 changes: 2 additions & 2 deletions helpers/request_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
function sendSimpleGetRequest($url = '', $data = array(), $method = 'GET')
{
$method = mb_strtoupper($method);
$method = mb_strtoupper((string)$method);
if ((!empty($data) && (is_array($data) || is_object($data)))) {
$target = $url . '?' . http_build_query($data);
} else {
Expand All @@ -39,7 +39,7 @@ function sendSimpleGetRequest($url = '', $data = array(), $method = 'GET')
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => array($UA),
);
if (isset($parseUrl['scheme']) && $parseUrl['scheme'] === 'https') {
Expand Down
8 changes: 4 additions & 4 deletions helpers/string_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,10 @@ function str_starts_with($needle, $haystack)
*/
function str_ignore_starts_with($needle, $haystack)
{
$hs = mb_strtolower($haystack);
$hs = mb_strtolower((string) $haystack);

foreach ((array)$needle as $ndl) {
$n = mb_strtolower($ndl);
$n = mb_strtolower((string) $ndl);
if ($n !== '' && mb_strpos($hs, $n) === 0) {
return true;
}
Expand Down Expand Up @@ -568,10 +568,10 @@ function str_ends_with($needle, $haystack)
*/
function str_ignore_ends_with($needle, $haystack)
{
$hs = mb_strtolower($haystack);
$hs = mb_strtolower((string) $haystack);

foreach ((array)$needle as $ndl) {
$n = mb_strtolower($ndl);
$n = mb_strtolower((string) $ndl);
$length = mb_strlen($ndl);
if ($length === 0 || (mb_substr($hs, -$length) === $n)) {
return true;
Expand Down
4 changes: 2 additions & 2 deletions helpers/url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function encodeId_Url_byHungDEV($id)
*/
function decodeId_Url_byHungDEV($id)
{
$id = mb_strtoupper($id);
$id = mb_strtoupper((string) $id);
$id = str_replace(
array('E', 'R', 'M', 'N', 'J', 'I', 'Z', 'K', 'L', 'O'),
array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
Expand Down Expand Up @@ -567,7 +567,7 @@ function convertToLatin($string = '', $alphabetOnly = false, $toLower = true)
$output = alphabetOnly($output);
}
if ($toLower) {
$output = mb_strtolower($output);
$output = mb_strtolower((string) $output);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/BaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
class BaseHelper
{
const VERSION = '1.6.6';
const LAST_MODIFIED = '2024-09-15';
const VERSION = '1.6.7';
const LAST_MODIFIED = '2024-09-22';
const PROJECT_NAME = 'CodeIgniter - Basic Helper';
const AUTHOR_NAME = 'Hung Nguyen';
const AUTHOR_FULL_NAME = 'Hung Nguyen';
Expand Down
6 changes: 3 additions & 3 deletions src/BasicCurl.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private function init()
*/
public function addResponseHeaderLine($curl, $header_line)
{
$trimmed_header = trim($header_line, "\r\n");
$trimmed_header = trim((string) $header_line, "\r\n");

if ($trimmed_header === "") {
$this->response_header_continue = false;
Expand Down Expand Up @@ -802,7 +802,7 @@ public function getResponseHeaders($headerKey = null)
{
$headers = array();
if (!is_null($headerKey)) {
$headerKey = strtolower($headerKey);
$headerKey = strtolower((string) $headerKey);
}

foreach ($this->response_headers as $header) {
Expand All @@ -811,7 +811,7 @@ public function getResponseHeaders($headerKey = null)
$key = isset($parts[0]) ? $parts[0] : '';
$value = isset($parts[1]) ? $parts[1] : '';

$headers[strtolower(trim($key))] = trim($value);
$headers[strtolower(trim((string) $key))] = trim($value);
}

if ($headerKey) {
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function setHeader($header = array())
public function sendRequest($url = '', $data = array(), $method = 'GET')
{
try {
$getMethod = mb_strtoupper($method);
$getMethod = mb_strtoupper((string) $method);
if ($this->DEBUG === true) {
$this->logger->info('||=========== Logger Send Requests ===========||');
$this->logger->info('Send ' . $getMethod . ' Request to URL: ' . $url, $data);
Expand Down
2 changes: 1 addition & 1 deletion src/Valid.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public static function credit_card($number, $type = null)
);

// Check card type
$type = mb_strtolower($type);
$type = mb_strtolower((string) $type);

if (!isset($cards[$type])) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ protected function validateUrlActive($field, $value)

foreach ($this->validUrlPrefixes as $prefix) {
if (mb_strpos($value, $prefix) !== false) {
$host = parse_url(mb_strtolower($value), PHP_URL_HOST);
$host = parse_url(mb_strtolower((string) $value), PHP_URL_HOST);

return checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA') || checkdnsrr($host, 'CNAME');
}
Expand Down