From 89131a73c2e53f0f7392ce8bc1deddd38bd676d4 Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 06:12:54 +0700 Subject: [PATCH 01/13] MDL-76415 lib: Fixed ${var} string interpolation deprecations in php-ml Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- lib/mlbackend/php/phpml/readme_moodle.txt | 7 ++++++- .../php/phpml/src/Phpml/Classification/DecisionTree.php | 4 ++-- .../Classification/DecisionTree/DecisionTreeLeaf.php | 8 ++++---- .../src/Phpml/Classification/Linear/DecisionStump.php | 2 +- .../php/phpml/src/Phpml/FeatureExtraction/StopWords.php | 2 +- lib/mlbackend/php/phpml/src/Phpml/Helper/OneVsRest.php | 2 +- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/mlbackend/php/phpml/readme_moodle.txt b/lib/mlbackend/php/phpml/readme_moodle.txt index df47da5bc0385..aec95619a3fe9 100644 --- a/lib/mlbackend/php/phpml/readme_moodle.txt +++ b/lib/mlbackend/php/phpml/readme_moodle.txt @@ -1,8 +1,13 @@ Current version is 0.8.0 -# Download latest stable version from https://github.com/php-ai/php-ml +# Download latest stable version from https://github.com/jorgecasas/php-ml # Remove all files but: * src/ * LICENSE # Copy content of src/ to /path/to/moodle/lib/mlbackend/php/phpml/src/Phpml # Copy LICENSE file to /path/to/moodle/lib/mlbackend/php/phpml +# Applied patch https://github.com/jorgecasas/php-ml/pull/5 + +2023/01/26 +---------- +- Changing the repository URL to https://github.com/jorgecasas/php-ml diff --git a/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree.php b/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree.php index 04cde5621e5cb..b187796e5f1f6 100644 --- a/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree.php +++ b/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree.php @@ -386,9 +386,9 @@ protected function preprocess(array $samples): array $median = Mean::median($values); foreach ($values as &$value) { if ($value <= $median) { - $value = "<= ${median}"; + $value = "<= {$median}"; } else { - $value = "> ${median}"; + $value = "> {$median}"; } } } diff --git a/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php b/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php index 04af3d62dbe3f..3f8bd2c5fc360 100644 --- a/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php +++ b/lib/mlbackend/php/phpml/src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php @@ -122,7 +122,7 @@ public function getNodeImpurityDecrease(int $parentRecordCount): float public function getHTML(?array $columnNames = null): string { if ($this->isTerminal) { - $value = "${this}->classValue"; + $value = "{$this}->classValue"; } else { $value = $this->value; if ($columnNames !== null) { @@ -132,13 +132,13 @@ public function getHTML(?array $columnNames = null): string } if ((bool) preg_match('/^[<>=]{1,2}/', (string) $value) === false) { - $value = "=${value}"; + $value = "={$value}"; } - $value = "${col} ${value}
Gini: ".number_format($this->giniIndex, 2); + $value = "{$col} {$value}
Gini: ".number_format($this->giniIndex, 2); } - $str = ""; + $str = "
${value}
"; if ($this->leftLeaf !== null || $this->rightLeaf !== null) { $str .= ''; diff --git a/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/DecisionStump.php b/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/DecisionStump.php index 258939e3a49e7..ae81d563da00a 100644 --- a/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/DecisionStump.php +++ b/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/DecisionStump.php @@ -87,7 +87,7 @@ public function __construct(int $columnIndex = self::AUTO_SELECT) public function __toString(): string { - return "IF ${this}->column ${this}->operator ${this}->value ". + return "IF {$this->column} {$this->operator} {$this->value} ". 'THEN '.$this->binaryLabels[0].' '. 'ELSE '.$this->binaryLabels[1]; } diff --git a/lib/mlbackend/php/phpml/src/Phpml/FeatureExtraction/StopWords.php b/lib/mlbackend/php/phpml/src/Phpml/FeatureExtraction/StopWords.php index f5622fd61d036..1b074105541db 100644 --- a/lib/mlbackend/php/phpml/src/Phpml/FeatureExtraction/StopWords.php +++ b/lib/mlbackend/php/phpml/src/Phpml/FeatureExtraction/StopWords.php @@ -25,7 +25,7 @@ public function isStopWord(string $token): bool public static function factory(string $language = 'English'): self { - $className = __NAMESPACE__."\\StopWords\\${language}"; + $className = __NAMESPACE__."\\StopWords\\{$language}"; if (!class_exists($className)) { throw new InvalidArgumentException(sprintf('Can\'t find "%s" language for StopWords', $language)); diff --git a/lib/mlbackend/php/phpml/src/Phpml/Helper/OneVsRest.php b/lib/mlbackend/php/phpml/src/Phpml/Helper/OneVsRest.php index 691fb6437f09a..b17fc025e12dc 100644 --- a/lib/mlbackend/php/phpml/src/Phpml/Helper/OneVsRest.php +++ b/lib/mlbackend/php/phpml/src/Phpml/Helper/OneVsRest.php @@ -157,7 +157,7 @@ abstract protected function predictSampleBinary(array $sample); */ private function binarizeTargets(array $targets, $label): array { - $notLabel = "not_${label}"; + $notLabel = "not_{$label}"; foreach ($targets as $key => $target) { $targets[$key] = $target == $label ? $label : $notLabel; } From 3f850a8a4ac783e3191028b9862b54e9cb475960 Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 09:17:26 +0700 Subject: [PATCH 02/13] MDL-76415 lib: Fixed ${var} str interpolation deprecations in php-jwt. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- lib/php-jwt/readme_moodle.txt | 6 ++++++ lib/php-jwt/src/JWT.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/php-jwt/readme_moodle.txt b/lib/php-jwt/readme_moodle.txt index 78820d50f35f9..0e61703089905 100644 --- a/lib/php-jwt/readme_moodle.txt +++ b/lib/php-jwt/readme_moodle.txt @@ -13,3 +13,9 @@ Instructions 4. Download the latest release. 5. Unzip it in lib as php-jwt. 6. Update entry for this library in lib/thirdpartylibs.xml. + +2023/01/26 +---------- +- src/JWT.php file has minor changes for PHP 8.2 compatibility. See MDL-76415 for more details. + Since version v6.3.1, the php-jwt already has the fix, so if someone executing the upgrading version and + it has the patch, please ignore this note. diff --git a/lib/php-jwt/src/JWT.php b/lib/php-jwt/src/JWT.php index 9964073d5efb1..d047f20322c18 100644 --- a/lib/php-jwt/src/JWT.php +++ b/lib/php-jwt/src/JWT.php @@ -136,7 +136,7 @@ public static function decode( // OpenSSL expects an ASN.1 DER sequence for ES256/ES384 signatures $sig = self::signatureToDER($sig); } - if (!self::verify("${headb64}.${bodyb64}", $sig, $key->getKeyMaterial(), $header->alg)) { + if (!self::verify("{$headb64}.{$bodyb64}", $sig, $key->getKeyMaterial(), $header->alg)) { // TODO: Remove this modification in MDL-76415. throw new SignatureInvalidException('Signature verification failed'); } From e9822519ebbd3f4ba2a10310f50d12ec5e1eaa64 Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 09:40:28 +0700 Subject: [PATCH 03/13] MDL-76415 lib: Fixed ${} string interpolation deprecations in phpxmlrpc Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- lib/phpxmlrpc/Server.php | 8 ++++---- lib/phpxmlrpc/Value.php | 20 ++++++++++---------- lib/phpxmlrpc/readme_moodle.txt | 5 ++++- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/phpxmlrpc/Server.php b/lib/phpxmlrpc/Server.php index 1cc965f3d324b..efeb1aab93d73 100644 --- a/lib/phpxmlrpc/Server.php +++ b/lib/phpxmlrpc/Server.php @@ -421,7 +421,7 @@ protected function verifySignature($in, $sigs) } } if (isset($wanted)) { - return array(0, "Wanted ${wanted}, got ${got} at param ${pno}"); + return array(0, "Wanted {$wanted}, got {$got} at param {$pno}"); // TODO: Remove this modification in MDL-76415. } else { return array(0, "No method signature matches number of parameters"); } @@ -669,7 +669,7 @@ protected function execute($req, $params = null, $paramTypes = null) return new Response( 0, PhpXmlRpc::$xmlrpcerr['incorrect_params'], - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}" + PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" // TODO: Remove this modification in MDL-76415. ); } } @@ -1020,8 +1020,8 @@ public static function _xmlrpcs_methodHelp($server, $req) public static function _xmlrpcs_multicall_error($err) { if (is_string($err)) { - $str = PhpXmlRpc::$xmlrpcstr["multicall_${err}"]; - $code = PhpXmlRpc::$xmlrpcerr["multicall_${err}"]; + $str = PhpXmlRpc::$xmlrpcstr["multicall_{$err}"]; // TODO: Remove this modification in MDL-76415. + $code = PhpXmlRpc::$xmlrpcerr["multicall_{$err}"]; // TODO: Remove this modification in MDL-76415. } else { $code = $err->faultCode(); $str = $err->faultString(); diff --git a/lib/phpxmlrpc/Value.php b/lib/phpxmlrpc/Value.php index e058957dc6f34..d7d0026594ef8 100644 --- a/lib/phpxmlrpc/Value.php +++ b/lib/phpxmlrpc/Value.php @@ -279,19 +279,19 @@ protected function serializedata($typ, $val, $charsetEncoding = '') case 1: switch ($typ) { case static::$xmlrpcBase64: - $rs .= "<${typ}>" . base64_encode($val) . ""; + $rs .= "<{$typ}>" . base64_encode($val) . ""; // TODO: Remove this modification in MDL-76415. break; case static::$xmlrpcBoolean: - $rs .= "<${typ}>" . ($val ? '1' : '0') . ""; + $rs .= "<{$typ}>" . ($val ? '1' : '0') . ""; // TODO: Remove this modification in MDL-76415. break; case static::$xmlrpcString: // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml - $rs .= "<${typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . ""; + $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . ""; // TODO: Remove this modification in MDL-76415. break; case static::$xmlrpcInt: case static::$xmlrpcI4: case static::$xmlrpcI8: - $rs .= "<${typ}>" . (int)$val . ""; + $rs .= "<{$typ}>" . (int)$val . ""; // TODO: Remove this modification in MDL-76415. break; case static::$xmlrpcDouble: // avoid using standard conversion of float to string because it is locale-dependent, @@ -299,18 +299,18 @@ protected function serializedata($typ, $val, $charsetEncoding = '') // sprintf('%F') could be most likely ok but it fails eg. on 2e-14. // The code below tries its best at keeping max precision while avoiding exp notation, // but there is of course no limit in the number of decimal places to be used... - $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . ""; + $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . ""; // TODO: Remove this modification in MDL-76415. break; case static::$xmlrpcDateTime: if (is_string($val)) { - $rs .= "<${typ}>${val}"; + $rs .= "<{$typ}>{$val}"; // TODO: Remove this modification in MDL-76415. } elseif (is_a($val, 'DateTime') || is_a($val, 'DateTimeInterface')) { - $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . ""; + $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . ""; // TODO: Remove this modification in MDL-76415. } elseif (is_int($val)) { - $rs .= "<${typ}>" . date('Ymd\TH:i:s', $val) . ""; + $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . ""; // TODO: Remove this modification in MDL-76415. } else { // not really a good idea here: but what should we output anyway? left for backward compat... - $rs .= "<${typ}>${val}"; + $rs .= "<{$typ}>{$val}"; // TODO: Remove this modification in MDL-76415. } break; case static::$xmlrpcNull: @@ -323,7 +323,7 @@ protected function serializedata($typ, $val, $charsetEncoding = '') default: // no standard type value should arrive here, but provide a possibility // for xmlrpc values of unknown type... - $rs .= "<${typ}>${val}"; + $rs .= "<{$typ}>{$val}"; // TODO: Remove this modification in MDL-76415. } break; case 3: diff --git a/lib/phpxmlrpc/readme_moodle.txt b/lib/phpxmlrpc/readme_moodle.txt index ae13fbaaebe4b..cf02d686ce2dc 100644 --- a/lib/phpxmlrpc/readme_moodle.txt +++ b/lib/phpxmlrpc/readme_moodle.txt @@ -19,4 +19,7 @@ To update: Current version imported: 4.8.1 (c74cc31) Local changes: - * readme_moodle.txt - this file ;-) + * 2023/01/26 - Server.php and Value.php files have minor changes for PHP 8.2 compatibility. See MDL-76415 for more details. + Since version 4.9.1, the phpxmlrpc already has the fix, so if someone executing the upgrading version and + it has the patch, please ignore this note. + * readme_moodle.txt - this file ;-) From 90e94a34982350837130ca8a85493fad73c27b06 Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 09:52:07 +0700 Subject: [PATCH 04/13] MDL-76415 blocks: Fixed ${var} string interpolation deprecations. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- .../site_main_menu/tests/behat/behat_block_site_main_menu.php | 2 +- .../tests/behat/behat_block_social_activities.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blocks/site_main_menu/tests/behat/behat_block_site_main_menu.php b/blocks/site_main_menu/tests/behat/behat_block_site_main_menu.php index 080879d140f31..00190399429f8 100644 --- a/blocks/site_main_menu/tests/behat/behat_block_site_main_menu.php +++ b/blocks/site_main_menu/tests/behat/behat_block_site_main_menu.php @@ -114,7 +114,7 @@ public function i_click_on_in_the_activity_in_site_main_menu_block($element, $se protected function get_site_menu_activity_element($element, $selectortype, $activityname) { $activitynode = $this->get_site_menu_activity_node($activityname); - $exception = new ElementNotFoundException($this->getSession(), "'{$element}' '{$selectortype}' in '${activityname}'"); + $exception = new ElementNotFoundException($this->getSession(), "'{$element}' '{$selectortype}' in '{$activityname}'"); return $this->find($selectortype, $element, $exception, $activitynode); } diff --git a/blocks/social_activities/tests/behat/behat_block_social_activities.php b/blocks/social_activities/tests/behat/behat_block_social_activities.php index ce6168df55a8e..ae026737b266d 100644 --- a/blocks/social_activities/tests/behat/behat_block_social_activities.php +++ b/blocks/social_activities/tests/behat/behat_block_social_activities.php @@ -122,7 +122,7 @@ public function i_click_on_in_the_activity_in_social_activities_block($element, protected function get_social_block_activity_element($element, $selectortype, $activityname) { $activitynode = $this->get_social_block_activity_node($activityname); - $exception = new ElementNotFoundException($this->getSession(), "'{$element}' '{$selectortype}' in '${activityname}'"); + $exception = new ElementNotFoundException($this->getSession(), "'{$element}' '{$selectortype}' in '{$activityname}'"); return $this->find($selectortype, $element, $exception, $activitynode); } From 113c78a110a5f3afd96eb9442903b928778d574b Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 09:54:01 +0700 Subject: [PATCH 05/13] MDL-76415 tool_componentlibrary: Fixed str interpolation deprecations. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- admin/tool/componentlibrary/jsdocspage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/tool/componentlibrary/jsdocspage.php b/admin/tool/componentlibrary/jsdocspage.php index 76be4a606f0d3..25a34dba1d177 100644 --- a/admin/tool/componentlibrary/jsdocspage.php +++ b/admin/tool/componentlibrary/jsdocspage.php @@ -33,7 +33,7 @@ $jsdocdir = "{$CFG->dirroot}/jsdoc"; if (file_exists($jsdocdir) && is_dir($jsdocdir)) { $relativepath = get_file_argument(); - redirect(new moodle_url("/jsdoc/${relativepath}")); + redirect(new moodle_url("/jsdoc/{$relativepath}")); } $PAGE->set_pagelayout('base'); From 6b02417e8ce8279698b1b5c392cccd22eb9cb668 Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 09:56:11 +0700 Subject: [PATCH 06/13] MDL-76415 core_course: Fixed ${var} string interpolation deprecations. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- course/tests/behat/behat_course.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/course/tests/behat/behat_course.php b/course/tests/behat/behat_course.php index c01eae8ad125a..283b94c6b226d 100644 --- a/course/tests/behat/behat_course.php +++ b/course/tests/behat/behat_course.php @@ -1173,7 +1173,7 @@ public function i_click_on_in_the_activity($element, $selectortype, $activitynam protected function get_activity_element($element, $selectortype, $activityname) { $activitynode = $this->get_activity_node($activityname); - $exception = new ElementNotFoundException($this->getSession(), "'{$element}' '{$selectortype}' in '${activityname}'"); + $exception = new ElementNotFoundException($this->getSession(), "'{$element}' '{$selectortype}' in '{$activityname}'"); return $this->find($selectortype, $element, $exception, $activitynode); } From e2cd808b34e0b02225876207ca4d7a50e328a2b4 Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 09:58:14 +0700 Subject: [PATCH 07/13] MDL-76415 core: Fixed ${var} string interpolation deprecations. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- lib/classes/lock/lock_config.php | 2 +- lib/dml/tests/dml_test.php | 8 ++++---- .../atto/tests/behat/behat_editor_atto.php | 8 ++++---- .../tests/behat/behat_editor_textarea.php | 4 ++-- lib/editor/tiny/classes/editor.php | 4 ++-- .../tiny/tests/behat/behat_editor_tiny.php | 16 ++++++++-------- lib/phpminimumversionlib.php | 2 +- lib/tests/component_test.php | 2 +- lib/tests/weblib_test.php | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/classes/lock/lock_config.php b/lib/classes/lock/lock_config.php index 2c00028bc1f19..301780890092d 100644 --- a/lib/classes/lock/lock_config.php +++ b/lib/classes/lock/lock_config.php @@ -60,7 +60,7 @@ public static function get_lock_factory_class(): string { $dbtype = clean_param($DB->get_dbfamily(), PARAM_ALPHA); // DB Specific lock factory is preferred - should support auto-release. - $lockfactoryclass = "\\core\\lock\\${dbtype}_lock_factory"; + $lockfactoryclass = "\\core\\lock\\{$dbtype}_lock_factory"; if (!class_exists($lockfactoryclass)) { $lockfactoryclass = '\core\lock\file_lock_factory'; } diff --git a/lib/dml/tests/dml_test.php b/lib/dml/tests/dml_test.php index fc96ae168b229..0667f73b51718 100644 --- a/lib/dml/tests/dml_test.php +++ b/lib/dml/tests/dml_test.php @@ -6292,10 +6292,10 @@ public function test_get_server_info_dbfamily_mysql() { ['description' => $description, 'version' => $version] = $DB->get_server_info(); // MariaDB RPL_VERSION_HACK sanity check: "5.5.5" has never been released! $this->assertNotSame('5.5.5', $version, - "Found invalid DB server version i.e. RPL_VERSION_HACK: '${version}' (${description})."); + "Found invalid DB server version i.e. RPL_VERSION_HACK: '{$version}' ({$description})."); // DB version format is: "X.Y.Z". $this->assertMatchesRegularExpression('/^\d+\.\d+\.\d+$/', $version, - "Found invalid DB server version format: '${version}' (${description})."); + "Found invalid DB server version format: '{$version}' ({$description})."); // Alter the DB options to force the read from DB and check for the same assertions above. $cfg->dboptions['versionfromdb'] = true; @@ -6309,9 +6309,9 @@ public function test_get_server_info_dbfamily_mysql() { $this->assertTrue($rcm->invokeArgs($db2, []), 'Invalid test state!'); ['description' => $description, 'version' => $version] = $db2->get_server_info(); $this->assertNotSame('5.5.5', $version, - "Found invalid DB server version when reading version from DB i.e. RPL_VERSION_HACK: '${version}' (${description})."); + "Found invalid DB server version when reading version from DB i.e. RPL_VERSION_HACK: '{$version}' ({$description})."); $this->assertMatchesRegularExpression('/^\d+\.\d+\.\d+$/', $version, - "Found invalid DB server version format when reading version from DB: '${version}' (${description})."); + "Found invalid DB server version format when reading version from DB: '{$version}' ({$description})."); $db2->dispose(); } } diff --git a/lib/editor/atto/tests/behat/behat_editor_atto.php b/lib/editor/atto/tests/behat/behat_editor_atto.php index 66aae827e913f..c4969f09555ae 100644 --- a/lib/editor/atto/tests/behat/behat_editor_atto.php +++ b/lib/editor/atto/tests/behat/behat_editor_atto.php @@ -49,13 +49,13 @@ class behat_editor_atto extends behat_base implements \core_behat\settable_edito public function set_editor_value(string $editorid, string $value): void { $js = << { Tiny.setupForElementId({ - elementId: "${elementid}", - options: ${configoptions}, + elementId: "{$elementid}", + options: {$configoptions}, }); M.util.js_complete('editor_tiny/editor'); }); diff --git a/lib/editor/tiny/tests/behat/behat_editor_tiny.php b/lib/editor/tiny/tests/behat/behat_editor_tiny.php index f0213ba7649fb..2eb915db282f9 100644 --- a/lib/editor/tiny/tests/behat/behat_editor_tiny.php +++ b/lib/editor/tiny/tests/behat/behat_editor_tiny.php @@ -50,7 +50,7 @@ class behat_editor_tiny extends behat_base implements \core_behat\settable_edito protected function execute_javascript_for_editor(string $editorid, string $code): void { $js = << { - const instance = editor.getInstanceForElementId('${editorid}'); + const instance = editor.getInstanceForElementId('{$editorid}'); {$code} }); EOF; @@ -72,9 +72,9 @@ protected function evaluate_javascript_for_editor(string $editorid, string $code $js = << { require(['editor_tiny/editor'], (editor) => { - const instance = editor.getInstanceForElementId('${editorid}'); + const instance = editor.getInstanceForElementId('{$editorid}'); if (!instance) { - reject("Instance '${editorid}' not found"); + reject("Instance '{$editorid}' not found"); } {$code} @@ -101,7 +101,7 @@ public function set_editor_value(string $editorid, string $value): void { } $this->execute_javascript_for_editor($editorid, << $attributes) { // Message, to be used later and easier finding the problem. - $message = "Validation problem found with API: ${apiname}"; + $message = "Validation problem found with API: {$apiname}"; $this->assertIsObject($attributes, $message); $this->assertMatchesRegularExpression('/^[a-z][a-z0-9]+$/', $apiname, $message); diff --git a/lib/tests/weblib_test.php b/lib/tests/weblib_test.php index 561b64a48dfb2..202ac33cc302f 100644 --- a/lib/tests/weblib_test.php +++ b/lib/tests/weblib_test.php @@ -881,7 +881,7 @@ public function test_extract_draft_file_urls_from_text() { $url1 = "{$CFG->wwwroot}/draftfile.php/5/user/draft/99999999/test1.jpg"; $url2 = "{$CFG->wwwroot}/draftfile.php/5/user/draft/99999998/test2.jpg"; - $html = "

This is a test.

\"\"

+ $html = "

This is a test.

\"\"


Test content.

\"\"

"; $draftareas = array( From d8474a647a10acffa1ad8d176c47bdad9153c745 Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 10:00:10 +0700 Subject: [PATCH 08/13] MDL-76415 gradereport_singleview: Fixed str interpolation deprecations. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- grade/report/singleview/classes/local/screen/select.php | 2 +- grade/report/singleview/classes/report/singleview.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grade/report/singleview/classes/local/screen/select.php b/grade/report/singleview/classes/local/screen/select.php index 3b4cad3564b72..b6f29005be5ca 100644 --- a/grade/report/singleview/classes/local/screen/select.php +++ b/grade/report/singleview/classes/local/screen/select.php @@ -97,7 +97,7 @@ public function html(): string { $types = gradereport_singleview\report\singleview::valid_screens(); foreach ($types as $type) { - $classname = "gradereport_singleview\\local\\screen\\${type}"; + $classname = "gradereport_singleview\\local\\screen\\{$type}"; $screen = new $classname($this->courseid, null, $this->groupid); diff --git a/grade/report/singleview/classes/report/singleview.php b/grade/report/singleview/classes/report/singleview.php index 20271e9115422..bef36d2a8ffd4 100644 --- a/grade/report/singleview/classes/report/singleview.php +++ b/grade/report/singleview/classes/report/singleview.php @@ -109,7 +109,7 @@ public function __construct( $this->setup_item_selector($itemtype, $itemid); - $screenclass = "\\gradereport_singleview\\local\\screen\\${itemtype}"; + $screenclass = "\\gradereport_singleview\\local\\screen\\{$itemtype}"; $this->screen = new $screenclass($courseid, $itemid, $this->currentgroup); From 3c0fa9b9cb17b7795b4b936e47dbecdbc27060aa Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 10:01:57 +0700 Subject: [PATCH 09/13] MDL-76415 assignfeedback_editpdf: Fixed str interpolation deprecations. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- mod/assign/feedback/editpdf/ajax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/assign/feedback/editpdf/ajax.php b/mod/assign/feedback/editpdf/ajax.php index 07f1188d57ec0..d79e4b39ce422 100644 --- a/mod/assign/feedback/editpdf/ajax.php +++ b/mod/assign/feedback/editpdf/ajax.php @@ -70,7 +70,7 @@ // Get a lock for the PDF/Image conversion of the assignment files. $lockfactory = \core\lock\lock_config::get_lock_factory('assignfeedback_editpdf_pollconversions'); - $resource = "user:${userid},assignmentid:${assignmentid},attemptnumber:${attemptnumber}"; + $resource = "user:{$userid},assignmentid:{$assignmentid},attemptnumber:{$attemptnumber}"; $lock = $lockfactory->get_lock($resource, 0); // Could not get lock, send back JSON to poll again. From 1e8ed4e3052af85443188368cec29270a69c5beb Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 10:02:46 +0700 Subject: [PATCH 10/13] MDL-76415 mod_forum: Fixed ${var} string interpolation deprecations. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- mod/forum/classes/privacy/provider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/forum/classes/privacy/provider.php b/mod/forum/classes/privacy/provider.php index ea7c3efa8d9f9..f6dfe7165c44f 100644 --- a/mod/forum/classes/privacy/provider.php +++ b/mod/forum/classes/privacy/provider.php @@ -658,7 +658,7 @@ protected static function export_discussion_data(int $userid, array $mappings) { LEFT JOIN {groups} g ON g.id = d.groupid LEFT JOIN {forum_discussion_subs} dsub ON dsub.discussion = d.id AND dsub.userid = :dsubuserid LEFT JOIN {forum_posts} p ON p.discussion = d.id - WHERE f.id ${foruminsql} + WHERE f.id {$foruminsql} AND ( d.userid = :discussionuserid OR p.userid = :postuserid OR From 1c218880a957c01466a3fb79dfb5011418b64811 Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 10:03:41 +0700 Subject: [PATCH 11/13] MDL-76415 portfolio: Fixed ${var} string interpolation deprecations. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- portfolio/googledocs/lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portfolio/googledocs/lib.php b/portfolio/googledocs/lib.php index 66fa8ecde7ec1..5b1bf566cfc30 100644 --- a/portfolio/googledocs/lib.php +++ b/portfolio/googledocs/lib.php @@ -99,7 +99,7 @@ public function send_package() { // Create each of the directories in Google Drive that we need. foreach ($directories as $directory) { // Update the current path for this file. - $path .= "${directory}/"; + $path .= "{$directory}/"; if (!isset($directoryids[$path])) { // This directory hasn't been created yet so let's go ahead and create it. From 2a33c2736ab1b00a2ab1d5d209f1929d0030da8a Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 10:04:24 +0700 Subject: [PATCH 12/13] MDL-76415 core_privacy: Fixed ${var} string interpolation deprecations. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- privacy/classes/tests/provider_testcase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/privacy/classes/tests/provider_testcase.php b/privacy/classes/tests/provider_testcase.php index c4405041a79e7..1d6b319765c70 100644 --- a/privacy/classes/tests/provider_testcase.php +++ b/privacy/classes/tests/provider_testcase.php @@ -100,7 +100,7 @@ public function export_context_data_for_user(int $userid, \context $context, str * @return string */ protected function get_provider_classname($component) { - $classname = "\\${component}\\privacy\\provider"; + $classname = "\\{$component}\\privacy\\provider"; if (!class_exists($classname)) { throw new \coding_exception("{$component} does not implement any provider"); From 52653007069753d904bf387c8d7ddd90638cc62b Mon Sep 17 00:00:00 2001 From: Meirza Date: Thu, 26 Jan 2023 10:05:09 +0700 Subject: [PATCH 13/13] MDL-76415 report_eventlist: Fixed str interpolation deprecations. Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression. --- report/eventlist/classes/list_generator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/report/eventlist/classes/list_generator.php b/report/eventlist/classes/list_generator.php index ba5c27b6b4aa2..0929f54449da9 100644 --- a/report/eventlist/classes/list_generator.php +++ b/report/eventlist/classes/list_generator.php @@ -66,11 +66,11 @@ public static function get_all_events_list($detail = true) { if ($detail) { $reflectionclass = new ReflectionClass($event); if (!$reflectionclass->isAbstract()) { - $eventinformation = self::format_data($eventinformation, "\\${event}"); + $eventinformation = self::format_data($eventinformation, "\\{$event}"); } } else { $parts = explode('\\', $event); - $eventinformation["\\${event}"] = array_shift($parts); + $eventinformation["\\{$event}"] = array_shift($parts); } } }
{$value}