diff --git a/helpers/html_helper.php b/helpers/html_helper.php index 3e56479..c44b374 100644 --- a/helpers/html_helper.php +++ b/helpers/html_helper.php @@ -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 { diff --git a/helpers/request_helper.php b/helpers/request_helper.php index 9aaed99..d0d67bd 100644 --- a/helpers/request_helper.php +++ b/helpers/request_helper.php @@ -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 { @@ -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') { diff --git a/helpers/string_helper.php b/helpers/string_helper.php index 51356d1..e8c625e 100644 --- a/helpers/string_helper.php +++ b/helpers/string_helper.php @@ -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; } @@ -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; diff --git a/helpers/url_helper.php b/helpers/url_helper.php index a833590..35c9598 100644 --- a/helpers/url_helper.php +++ b/helpers/url_helper.php @@ -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'), @@ -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); } } diff --git a/src/BaseHelper.php b/src/BaseHelper.php index 16221ce..4d3b73b 100644 --- a/src/BaseHelper.php +++ b/src/BaseHelper.php @@ -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'; diff --git a/src/BasicCurl.php b/src/BasicCurl.php index fafd59b..7dd00ff 100644 --- a/src/BasicCurl.php +++ b/src/BasicCurl.php @@ -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; @@ -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) { @@ -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) { diff --git a/src/SimpleRequests.php b/src/SimpleRequests.php index ddebcd7..8ca2b74 100644 --- a/src/SimpleRequests.php +++ b/src/SimpleRequests.php @@ -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); diff --git a/src/Valid.php b/src/Valid.php index 7179733..60610c5 100644 --- a/src/Valid.php +++ b/src/Valid.php @@ -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; diff --git a/src/Validator.php b/src/Validator.php index 16d87f0..22b9802 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -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'); }