From 5f3b930437ae03ae5dff61269024d8ea1b3774aa Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 11 Sep 2024 09:34:10 +0200 Subject: [PATCH] Various fixes and removed deprecations --- Iconv.php | 26 -------------------------- bootstrap.php | 6 +----- bootstrap80.php | 6 +----- 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/Iconv.php b/Iconv.php index c17a70d..b442144 100644 --- a/Iconv.php +++ b/Iconv.php @@ -429,32 +429,6 @@ public static function iconv_mime_encode($fieldName, $fieldValue, $pref = null) } public static function iconv_strlen($s, $encoding = null) - { - static $hasXml = null; - if (null === $hasXml) { - $hasXml = \extension_loaded('xml'); - } - - if ($hasXml) { - return self::strlen1($s, $encoding); - } - - return self::strlen2($s, $encoding); - } - - public static function strlen1($s, $encoding = null) - { - if (null === $encoding) { - $encoding = self::$internalEncoding; - } - if (0 !== stripos($encoding, 'utf-8') && false === $s = self::iconv($encoding, 'utf-8', $s)) { - return false; - } - - return \strlen(utf8_decode($s)); - } - - public static function strlen2($s, $encoding = null) { if (null === $encoding) { $encoding = self::$internalEncoding; diff --git a/bootstrap.php b/bootstrap.php index c11df3b..e629531 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -66,11 +66,7 @@ function iconv_mime_decode($string, $mode = 0, $encoding = null) { $currentMbEnc } } else { if (!function_exists('iconv_strlen')) { - if (extension_loaded('xml')) { - function iconv_strlen($string, $encoding = null) { return p\Iconv::strlen1($string, $encoding); } - } else { - function iconv_strlen($string, $encoding = null) { return p\Iconv::strlen2($string, $encoding); } - } + function iconv_strlen($string, $encoding = null) { return p\Iconv::iconv_strlen($string, $encoding); } } if (!function_exists('iconv_strpos')) { diff --git a/bootstrap80.php b/bootstrap80.php index 04b1473..2d0f12f 100644 --- a/bootstrap80.php +++ b/bootstrap80.php @@ -58,11 +58,7 @@ function iconv_mime_decode($string, $mode = 0, $encoding = null) { $currentMbEnc } } else { if (!function_exists('iconv_strlen')) { - if (extension_loaded('xml')) { - function iconv_strlen(?string $string, ?string $encoding = null): int|false { return p\Iconv::strlen1((string) $string, $encoding); } - } else { - function iconv_strlen(?string $string, ?string $encoding = null): int|false { return p\Iconv::strlen2((string) $string, $encoding); } - } + function iconv_strlen(?string $string, ?string $encoding = null): int|false { return p\Iconv::iconv_strlen((string) $string, $encoding); } } if (!function_exists('iconv_strpos')) {