From 96cc904b517c8f76fcbf7c13a420a5be531c1b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=9C=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE=D0=B2?= Date: Wed, 1 Nov 2023 16:19:07 +0300 Subject: [PATCH] Unicode support for PhraseBuilder --- src/Gregwar/Captcha/PhraseBuilder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gregwar/Captcha/PhraseBuilder.php b/src/Gregwar/Captcha/PhraseBuilder.php index aa6ecf1..f691774 100644 --- a/src/Gregwar/Captcha/PhraseBuilder.php +++ b/src/Gregwar/Captcha/PhraseBuilder.php @@ -40,7 +40,7 @@ public function build($length = null, $charset = null) } $phrase = ''; - $chars = str_split($this->charset); + $chars = mb_str_split($this->charset); for ($i = 0; $i < $this->length; $i++) { $phrase .= $chars[array_rand($chars)]; @@ -62,7 +62,7 @@ public function niceize($str) */ public static function doNiceize($str) { - return strtr(strtolower($str), '01', 'ol'); + return strtr(mb_strtolower($str), '01', 'ol'); } /**