From b1b5f5b53705a8d1f3ab33860a618ecb4395521f Mon Sep 17 00:00:00 2001 From: kambereBr Date: Sun, 8 Sep 2024 23:45:08 +0200 Subject: [PATCH] [FIX] Revert mb_strlen to strlen for accurate byte count --- modules/core/functions.php | 8 ++++---- modules/core/message_functions.php | 2 +- modules/imap/hm-imap-base.php | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/core/functions.php b/modules/core/functions.php index d1bc61fc43..8673d55951 100644 --- a/modules/core/functions.php +++ b/modules/core/functions.php @@ -180,7 +180,7 @@ function is_email_address($val, $allow_local=false) { $val = trim($val, "<>"); $domain = false; $local = false; - if (!trim($val) || mb_strlen($val) > 320) { + if (!trim($val) || strlen($val) > 320) { return false; } if (mb_strpos($val, '@') !== false) { @@ -213,8 +213,8 @@ function is_email_address($val, $allow_local=false) { if (!hm_exists('validate_domain_full')) { function validate_domain_full($val) { /* check for a dot, max allowed length and standard ASCII characters */ - if (mb_strpos($val, '.') === false || mb_strlen($val) > 255 || preg_match("/[^A-Z0-9\-\.]/i", $val) || - $val[0] == '-' || $val[(mb_strlen($val) - 1)] == '-') { + if (mb_strpos($val, '.') === false || strlen($val) > 255 || preg_match("/[^A-Z0-9\-\.]/i", $val) || + $val[0] == '-' || $val[(strlen($val) - 1)] == '-') { return false; } return true; @@ -229,7 +229,7 @@ function validate_domain_full($val) { if (!hm_exists('validate_local_full')) { function validate_local_full($val) { /* check length, "." rules, and for characters > ASCII 127 */ - if (mb_strlen($val) > 64 || $val[0] == '.' || $val[(mb_strlen($val) -1)] == '.' || mb_strstr($val, '..') || + if (strlen($val) > 64 || $val[0] == '.' || $val[(strlen($val) -1)] == '.' || mb_strstr($val, '..') || preg_match('/[^\x00-\x7F]/',$val)) { return false; } diff --git a/modules/core/message_functions.php b/modules/core/message_functions.php index 8d34ad2bbc..41b9cfad6f 100644 --- a/modules/core/message_functions.php +++ b/modules/core/message_functions.php @@ -497,7 +497,7 @@ function trim_email($val) { if (!hm_exists('addr_split')) { function addr_split($str, $seps = array(',', ';')) { $str = preg_replace('/(\s){2,}/', ' ', $str); - $max = mb_strlen($str); + $max = strlen($str); $word = ''; $words = array(); $capture = false; diff --git a/modules/imap/hm-imap-base.php b/modules/imap/hm-imap-base.php index f1744dd033..9f070d408c 100644 --- a/modules/imap/hm-imap-base.php +++ b/modules/imap/hm-imap-base.php @@ -69,11 +69,11 @@ private function command_number() { private function read_literal($size, $max, $current, $line_length) { $left_over = false; $literal_data = $this->fgets($line_length); - $lit_size = mb_strlen($literal_data); + $lit_size = strlen($literal_data); $current += $lit_size; while ($lit_size < $size) { $chunk = $this->fgets($line_length); - $chunk_size = mb_strlen($chunk); + $chunk_size = strlen($chunk); $lit_size += $chunk_size; $current += $chunk_size; $literal_data .= $chunk; @@ -85,10 +85,10 @@ private function read_literal($size, $max, $current, $line_length) { if ($this->max_read) { while ($lit_size < $size) { $temp = $this->fgets($line_length); - $lit_size += mb_strlen($temp); + $lit_size += strlen($temp); } } - elseif ($size < mb_strlen($literal_data)) { + elseif ($size < strlen($literal_data)) { $left_over = mb_substr($literal_data, $size); $literal_data = mb_substr($literal_data, 0, $size); }