From 0cb706af149819075f36b7a003861c7f4f0d0eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=9B=D0=B5?= =?UTF-8?q?=D0=B1=D0=B5=D0=B4=D0=B5=D0=B2?= <dmitriy.lebedev@bars-open.ru> Date: Fri, 13 Oct 2017 10:08:30 +0300 Subject: [PATCH] Let `utf8_substr` use `utf8_strlen` instead of `strlen(utf8_decode($value))` --- inc/utf8.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/utf8.php b/inc/utf8.php index e2c7488d8..4de287429 100644 --- a/inc/utf8.php +++ b/inc/utf8.php @@ -212,7 +212,7 @@ if(!function_exists('utf8_substr')){ // normalise -ve offsets (we could use a tail anchored pattern, but they are horribly slow!) if ($offset < 0) { - $strlen = strlen(utf8_decode($str)); // see notes + $strlen = utf8_strlen($str); // see notes $offset = $strlen + $offset; if ($offset < 0) $offset = 0; } @@ -233,7 +233,7 @@ if(!function_exists('utf8_substr')){ $length_pattern = '(.*)$'; // the rest of the string } else { - if (!isset($strlen)) $strlen = strlen(utf8_decode($str)); // see notes + if (!isset($strlen)) $strlen = utf8_strlen($str); // see notes if ($offset > $strlen) return ''; // another trivial case if ($length > 0) { -- GitLab