MDL-73586 mod_wiki: Removed php init param for php80 and up
For PHP 8 and up, the 'mbstring.func_overload' doesn't exist anymore, so skip any check/condition based on it. The patch has been done that way, so it's easier to remove the whole block of code once PHP 8.0 becomes our min supported PHP version. The change is self-coveres (changes the external and its own tests).
This commit is contained in:
@@ -512,10 +512,14 @@ class mod_wiki_external extends external_api {
|
||||
$retpage['contentformat'] = $contentformat;
|
||||
} else {
|
||||
// Return the size of the content.
|
||||
if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) {
|
||||
$retpage['contentsize'] = mb_strlen($cachedcontent, '8bit');
|
||||
} else {
|
||||
$retpage['contentsize'] = strlen($cachedcontent);
|
||||
$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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -644,10 +644,14 @@ 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) {
|
||||
if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) {
|
||||
$expectedpages[$i]['contentsize'] = mb_strlen($expectedpages[$i]['cachedcontent'], '8bit');
|
||||
} else {
|
||||
$expectedpages[$i]['contentsize'] = strlen($expectedpages[$i]['cachedcontent']);
|
||||
$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');
|
||||
}
|
||||
}
|
||||
unset($expectedpages[$i]['cachedcontent']);
|
||||
unset($expectedpages[$i]['contentformat']);
|
||||
|
||||
Reference in New Issue
Block a user