mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Merge branch 'MDL-73586_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE
This commit is contained in:
commit
ed07b798e9
5 changed files with 27 additions and 13 deletions
|
@ -20,3 +20,6 @@ from the list. If still not available upstream, they will need to be re-applied.
|
|||
|
||||
- MDL-67114: PHP 7.4 compatibility. Array operations on scalar value.
|
||||
This corresponds to upstream https://github.com/bobthecow/mustache.php/pull/352
|
||||
- MDL-73586: PHP 8.0 compatibility. Removed 'mbstring.func_overload' init setting.
|
||||
This corresponds to upstream commit https://github.com/bobthecow/mustache.php/commit/e7165a33b282ab4d20b3863825caadb46313d62b
|
||||
that is availbale for the library versions 2.14.1 and up
|
||||
|
|
|
@ -97,11 +97,16 @@ class Mustache_Tokenizer
|
|||
// Setting mbstring.func_overload makes things *really* slow.
|
||||
// Let's do everyone a favor and scan this string as ASCII instead.
|
||||
//
|
||||
// The INI directive was removed in PHP 8.0 so we don't need to check there (and can drop it
|
||||
// when we remove support for older versions of PHP).
|
||||
//
|
||||
// @codeCoverageIgnoreStart
|
||||
$encoding = null;
|
||||
if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) {
|
||||
$encoding = mb_internal_encoding();
|
||||
mb_internal_encoding('ASCII');
|
||||
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
|
||||
if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) {
|
||||
$encoding = mb_internal_encoding();
|
||||
mb_internal_encoding('ASCII');
|
||||
}
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@ ini_set('log_errors', '1');
|
|||
if (ini_get('opcache.enable') and strtolower(ini_get('opcache.enable')) !== 'off') {
|
||||
if (!ini_get('opcache.save_comments') or strtolower(ini_get('opcache.save_comments')) === 'off') {
|
||||
ini_set('opcache.enable', 0);
|
||||
} else {
|
||||
ini_set('opcache.load_comments', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue