From 03a1ca582ba78d8e5236aa3d1471022b0a8c2799 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 1 Feb 2023 08:32:10 +0000 Subject: [PATCH] MDL-77102 mod_wiki: remove deprecated mbstring overload checks. --- mod/wiki/classes/external.php | 10 +--------- mod/wiki/tests/externallib_test.php | 10 +--------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/mod/wiki/classes/external.php b/mod/wiki/classes/external.php index 9c37f49586d..b8dd32738e1 100644 --- a/mod/wiki/classes/external.php +++ b/mod/wiki/classes/external.php @@ -494,15 +494,7 @@ class mod_wiki_external extends external_api { $retpage['contentformat'] = $contentformat; } else { // Return the size of the content. - $retpage['contentsize'] = strlen($cachedcontent); - // TODO: Remove this block of code once PHP 8.0 is the min version supported. - // For PHP < 8.0, if strlen() was overloaded, calculate - // the bytes using mb_strlen(..., '8bit'). - if (PHP_VERSION_ID < 80000) { - if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) { - $retpage['contentsize'] = mb_strlen($cachedcontent, '8bit'); - } - } + $retpage['contentsize'] = \core_text::strlen($cachedcontent); } $returnedpages[] = $retpage; diff --git a/mod/wiki/tests/externallib_test.php b/mod/wiki/tests/externallib_test.php index 9f16ca4e023..4e728f4c2b3 100644 --- a/mod/wiki/tests/externallib_test.php +++ b/mod/wiki/tests/externallib_test.php @@ -646,15 +646,7 @@ class externallib_test extends externallib_advanced_testcase { // Check that WS doesn't return page content if includecontent is false, it returns the size instead. foreach ($expectedpages as $i => $expectedpage) { - $expectedpages[$i]['contentsize'] = strlen($expectedpages[$i]['cachedcontent']); - // TODO: Remove this block of code once PHP 8.0 is the min version supported. - // For PHP < 8.0, if strlen() was overloaded, calculate - // the bytes using mb_strlen(..., '8bit'). - if (PHP_VERSION_ID < 80000) { - if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) { - $expectedpages[$i]['contentsize'] = mb_strlen($expectedpages[$i]['cachedcontent'], '8bit'); - } - } + $expectedpages[$i]['contentsize'] = \core_text::strlen($expectedpages[$i]['cachedcontent']); unset($expectedpages[$i]['cachedcontent']); unset($expectedpages[$i]['contentformat']); }