diff --git a/lang/en/admin.php b/lang/en/admin.php index b461862c01b..88352b32ef5 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -760,7 +760,6 @@ $string['choosefiletoedit'] = 'Choose file to edit'; $string['h5pgetcontenttypestask'] = 'Download available H5P content types from h5p.org'; $string['taskh5pcleanup'] = 'Unused H5P files cleanup'; $string['iconvrequired'] = 'Installing ICONV extension is required.'; -$string['igbinary322buggyversion'] = 'The php-igbinary extension installed on the site can lead to problems when running with PHP 7.2. You are recommended to either upgrade to php-igbinary 3.2.5 or later, or alternatively to upgrade to PHP 7.3 or later.'; $string['ignore'] = 'Ignore'; $string['includemoduleuserdata'] = 'Include module user data'; $string['incompatibleblocks'] = 'Incompatible blocks'; @@ -1667,3 +1666,4 @@ be removed from core Moodle. They will be available as plugins in the Moodle plugins directory.

If you wish to continue using Chat or Survey in your site, you will be able to install them as plugins before upgrading to Moodle 5.0.

'; $string['importantupdates_title'] = 'Important update about Chat and Survey activities'; +$string['igbinary322buggyversion'] = 'The php-igbinary extension installed on the site can lead to problems when running with PHP 7.2. You are recommended to either upgrade to php-igbinary 3.2.5 or later, or alternatively to upgrade to PHP 7.3 or later.'; diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 031446af1be..3614193f749 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -933,3 +933,35 @@ function question_delete_course_category($category, $newcategory, $notused = fal return true; } + +/** + * Check if the igbinary extension installed is buggy one + * + * There are a few php-igbinary versions that are buggy and + * return any unserialised array with wrong index. This defeats + * key() and next() operations on them. + * + * This library is used by MUC and also by memcached and redis + * when available. + * + * Let's inform if there is some problem when: + * - php 7.2 is being used (php 7.3 and up are immune). + * - the igbinary extension is installed. + * - the version of the extension is between 3.2.2 and 3.2.4. + * - the buggy behaviour is reproduced. + * + * @param environment_results $result object to update, if relevant. + * @return environment_results|null updated results or null. + * + * @deprecated Since Moodle 5.0 + * @todo Final deprecation on Moodle 6.0. See MDL-83675. + */ +#[\core\attribute\deprecated( + since: '5.0', + mdl: 'MDL-73700', + reason: 'Remove all the old php version checks from core', +)] +function check_igbinary322_version(environment_results $result) { + \core\deprecation::emit_deprecation_if_present(__FUNCTION__); + return null; +} diff --git a/lib/upgradelib.php b/lib/upgradelib.php index 34b7802b865..0083d2cc9a9 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -2463,59 +2463,6 @@ function check_sixtyfour_bits(environment_results $result) { return null; } -/** - * Check if the igbinary extension installed is buggy one - * - * There are a few php-igbinary versions that are buggy and - * return any unserialised array with wrong index. This defeats - * key() and next() operations on them. - * - * This library is used by MUC and also by memcached and redis - * when available. - * - * Let's inform if there is some problem when: - * - php 7.2 is being used (php 7.3 and up are immune). - * - the igbinary extension is installed. - * - the version of the extension is between 3.2.2 and 3.2.4. - * - the buggy behaviour is reproduced. - * - * @param environment_results $result object to update, if relevant. - * @return environment_results|null updated results or null. - */ -function check_igbinary322_version(environment_results $result) { - - // No problem if using PHP version 7.3 and up. - $phpversion = normalize_version(phpversion()); - if (version_compare($phpversion, '7.3', '>=')) { - return null; - } - - // No problem if igbinary is not installed.. - if (!function_exists('igbinary_serialize')) { - return null; - } - - // No problem if using igbinary < 3.2.2 or > 3.2.4. - $igbinaryversion = normalize_version(phpversion('igbinary')); - if (version_compare($igbinaryversion, '3.2.2', '<') or version_compare($igbinaryversion, '3.2.4', '>')) { - return null; - } - - // Let's verify the real behaviour to see if the bug is around. - // Note that we need this extra check because they released 3.2.5 with 3.2.4 version number, so - // over the paper, there are 3.2.4 working versions (3.2.5 ones with messed reflection version). - $data = [1, 2, 3]; - $data = igbinary_unserialize(igbinary_serialize($data)); - if (key($data) === 0) { - return null; - } - - // Arrived here, we are using PHP 7.2 and a buggy verified igbinary version, let's inform and don't allow to continue. - $result->setInfo('igbinary version problem'); - $result->setStatus(false); - return $result; -} - /** * This function checks that the database prefix ($CFG->prefix) is <= xmldb_table::PREFIX_MAX_LENGTH *