From 2369cb908b33d7b7518cce042615de430142497f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 9 Sep 2024 16:07:19 +0200 Subject: [PATCH 1/3] Give testing some love --- bootstrap80.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap80.php b/bootstrap80.php index 5be7d20..5236e6d 100644 --- a/bootstrap80.php +++ b/bootstrap80.php @@ -133,11 +133,11 @@ function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $ } if (!function_exists('mb_ucfirst')) { - function mb_ucfirst($string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); } + function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); } } if (!function_exists('mb_lcfirst')) { - function mb_lcfirst($string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); } + function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); } } if (!function_exists('mb_trim')) { From 6c1cb6eb3827aac159ca7a43d3cc39ccc066a3eb Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 4 Nov 2024 18:32:35 +0900 Subject: [PATCH 2/3] mbstring: Fix mb_rtrim() for UTF-8 text --- Mbstring.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mbstring.php b/Mbstring.php index 3d45c9d..31e36a3 100644 --- a/Mbstring.php +++ b/Mbstring.php @@ -983,7 +983,7 @@ public static function mb_ltrim(string $string, ?string $characters = null, ?str public static function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { - return self::mb_internal_trim('{[%s]+$}D', $string, $characters, $encoding, __FUNCTION__); + return self::mb_internal_trim('{[%s]+$}Du', $string, $characters, $encoding, __FUNCTION__); } private static function mb_internal_trim(string $regex, string $string, ?string $characters, ?string $encoding, string $function): string From 01072b6390f901ee1184eba610c7d19e156c1809 Mon Sep 17 00:00:00 2001 From: Jaap van Otterdijk Date: Fri, 22 Nov 2024 14:24:36 +0100 Subject: [PATCH 3/3] Require iconv for mbstring As the mbstring polyfill using the iconv functions a lot, if not in all calls being done, code without iconv using this polyfill will break. As this repo also provides a polyfill for iconv I don't think this will be a breaking change. --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4ed241a..daa07f8 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ } ], "require": { - "php": ">=7.2" + "php": ">=7.2", + "ext-iconv": "*" }, "provide": { "ext-mbstring": "*"