diff --git a/admin/tool/log/store/legacy/classes/log/store.php b/admin/tool/log/store/legacy/classes/log/store.php index 9bd89e2424d..42ffcfbf763 100644 --- a/admin/tool/log/store/legacy/classes/log/store.php +++ b/admin/tool/log/store/legacy/classes/log/store.php @@ -86,7 +86,7 @@ class store implements \tool_log\log\store, \core\log\sql_reader { } // Replace crud fields. - $selectwhere = preg_replace_callback("/(crud).*?(<>|=|!=).*?'(.*?)'/s", 'self::replace_crud', $selectwhere); + $selectwhere = preg_replace_callback("/(crud).*?(<>|=|!=).*?'(.*?)'/s", self::class .'::replace_crud', $selectwhere); return array($selectwhere, $params, $sort); } diff --git a/lib/adminlib.php b/lib/adminlib.php index bc8bc67c7ed..a64723d9bb0 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -4768,7 +4768,7 @@ class admin_setting_sitesettext extends admin_setting_configtext { * Constructor. */ public function __construct() { - call_user_func_array(['parent', '__construct'], func_get_args()); + call_user_func_array([parent::class, '__construct'], func_get_args()); $this->set_force_ltr(false); } diff --git a/lib/adodb/drivers/adodb-pdo.inc.php b/lib/adodb/drivers/adodb-pdo.inc.php index e0e6c729724..994ba9b2420 100644 --- a/lib/adodb/drivers/adodb-pdo.inc.php +++ b/lib/adodb/drivers/adodb-pdo.inc.php @@ -234,7 +234,7 @@ class ADODB_pdo extends ADOConnection { return call_user_func_array(array($this->_driver, 'Concat'), $args); } - return call_user_func_array('parent::Concat', $args); + return call_user_func_array(parent::class . '::Concat', $args); } /** @@ -254,7 +254,7 @@ class ADODB_pdo extends ADOConnection { } // No driver specific method defined, use mysql format '?' - return call_user_func_array('parent::param', $args); + return call_user_func_array(parent::class . '::param', $args); } // returns true or false diff --git a/lib/adodb/readme_moodle.txt b/lib/adodb/readme_moodle.txt index be981c8fbe1..bd23859ef63 100644 --- a/lib/adodb/readme_moodle.txt +++ b/lib/adodb/readme_moodle.txt @@ -23,3 +23,7 @@ Removed: Added: * index.html - prevent directory browsing on misconfigured servers * readme_moodle.txt - this file ;-) + +Notes: + * 2023-02-10 Applied patch https://github.com/ADOdb/ADOdb/pull/928 to avoid PHP 8.2 deprecations. + See MDL-76413 for more details. \ No newline at end of file diff --git a/lib/evalmath/evalmath.class.php b/lib/evalmath/evalmath.class.php index 7e1a8790b30..54bba6b3c62 100644 --- a/lib/evalmath/evalmath.class.php +++ b/lib/evalmath/evalmath.class.php @@ -557,7 +557,7 @@ class EvalMathFuncs { static function average() { $args = func_get_args(); - return (call_user_func_array(array('self', 'sum'), $args) / count($args)); + return (call_user_func_array(array(self::class, 'sum'), $args) / count($args)); } static function max() { diff --git a/lib/evalmath/readme_moodle.txt b/lib/evalmath/readme_moodle.txt index b40f83b79f0..3d460eb9986 100644 --- a/lib/evalmath/readme_moodle.txt +++ b/lib/evalmath/readme_moodle.txt @@ -29,3 +29,7 @@ Changes by Stefan Erlachner, Thomas Niedermaier (MDL-64414): e.g. if (or(condition_1, condition_2, ... condition_n)) * add function and: e.g. if (and(condition_1, condition_2, ... condition_n)) + +Changes by Raquel Ortega (MDL-76413) +* Avoid PHP 8.2: Partially-supported callable deprecations +* eg: call_user_func_array(array('self', 'sum'), $args to call_user_func_array(array(self::class, 'sum'), $args) \ No newline at end of file diff --git a/lib/minify/matthiasmullie-minify/src/JS.php b/lib/minify/matthiasmullie-minify/src/JS.php index 1e1679740f8..418f34e4257 100644 --- a/lib/minify/matthiasmullie-minify/src/JS.php +++ b/lib/minify/matthiasmullie-minify/src/JS.php @@ -124,7 +124,7 @@ class JS extends Minify */ public function __construct() { - call_user_func_array(array('parent', '__construct'), func_get_args()); + call_user_func_array(array('\\MatthiasMullie\Minify\\Minify', '__construct'), func_get_args()); $dataDir = __DIR__.'/../data/js/'; $options = FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES; diff --git a/lib/minify/readme_moodle.txt b/lib/minify/readme_moodle.txt index c7fbc85c696..c20deac59f4 100644 --- a/lib/minify/readme_moodle.txt +++ b/lib/minify/readme_moodle.txt @@ -20,3 +20,9 @@ MDL-68191: https://github.com/matthiasmullie/minify/issues/317 is a bug that sto a few seconds. This is one of the reasons Behat runs in the browser are so slow.) Whenever this library is updated check if the fix is included and remove this note. NOTE: As of 2020/12/08, only the first commit was brought into Moodle + +Note: + * 2023-02-10 Apply commit https://github.com/matthiasmullie/minify/commit/aa8010c2fa3c26f018874141d36025085754abff + to avoid PHP 8.2 deprecations. See MDL-76413 for more details. + Since new version already have this fix if someone executing the upgrading version and + it has already the patch please ignore this note. diff --git a/message/tests/externallib_test.php b/message/tests/externallib_test.php index 37b0c67e2eb..ba461adf5c8 100644 --- a/message/tests/externallib_test.php +++ b/message/tests/externallib_test.php @@ -2650,7 +2650,7 @@ class externallib_test extends externallib_advanced_testcase { // Confirm the data is correct. $contacts = $result; - usort($contacts, ['static', 'sort_contacts_id']); + usort($contacts, [static::class, 'sort_contacts_id']); $this->assertCount(3, $contacts); $contact1 = array_shift($contacts); @@ -2715,7 +2715,7 @@ class externallib_test extends externallib_advanced_testcase { // Confirm the data is correct. $contacts = $result; - usort($contacts, ['static', 'sort_contacts_id']); + usort($contacts, [static::class, 'sort_contacts_id']); $this->assertCount(3, $contacts); $contact1 = array_shift($contacts); diff --git a/message/tests/privacy/provider_test.php b/message/tests/privacy/provider_test.php index 9863c5906b3..9df8c83204f 100644 --- a/message/tests/privacy/provider_test.php +++ b/message/tests/privacy/provider_test.php @@ -550,7 +550,7 @@ class provider_test extends \core_privacy\tests\provider_testcase { $writer = writer::with_context($user1context); $contacts = (array) $writer->get_data([get_string('contacts', 'core_message')]); - usort($contacts, ['static', 'sort_contacts']); + usort($contacts, [static::class, 'sort_contacts']); $this->assertCount(3, $contacts); @@ -706,7 +706,7 @@ class provider_test extends \core_privacy\tests\provider_testcase { $dbm2 = $DB->get_record('messages', ['id' => $m2]); $dbm3 = $DB->get_record('messages', ['id' => $m3]); - usort($messages, ['static', 'sort_messages']); + usort($messages, [static::class, 'sort_messages']); $m1 = array_shift($messages); $m2 = array_shift($messages); $m3 = array_shift($messages); @@ -736,7 +736,7 @@ class provider_test extends \core_privacy\tests\provider_testcase { $dbm5 = $DB->get_record('messages', ['id' => $m5]); $dbm6 = $DB->get_record('messages', ['id' => $m6]); - usort($messages, ['static', 'sort_messages']); + usort($messages, [static::class, 'sort_messages']); $m4 = array_shift($messages); $m5 = array_shift($messages); $m6 = array_shift($messages); @@ -1740,7 +1740,7 @@ class provider_test extends \core_privacy\tests\provider_testcase { ]); $this->assertCount(3, $messages); - usort($messages, ['static', 'sort_messages']); + usort($messages, [static::class, 'sort_messages']); $m1 = array_shift($messages); $m2 = array_shift($messages); $m3 = array_shift($messages); @@ -1810,7 +1810,7 @@ class provider_test extends \core_privacy\tests\provider_testcase { ]); $this->assertCount(3, $messages); - usort($messages, ['static', 'sort_messages']); + usort($messages, [static::class, 'sort_messages']); $m1 = array_shift($messages); $m2 = array_shift($messages); $m3 = array_shift($messages); diff --git a/tag/classes/collection.php b/tag/classes/collection.php index 0fa1b882be3..97147b23c8c 100644 --- a/tag/classes/collection.php +++ b/tag/classes/collection.php @@ -392,7 +392,7 @@ class core_tag_collection { } self::$cloudsortfield = $sort; - usort($tagsincloud, "self::cloud_sort"); + usort($tagsincloud, self::class . "::cloud_sort"); return new core_tag\output\tagcloud($tagsincloud, $tagscount, $fromctx, $ctx, $rec); }