diff --git a/admin/renderer.php b/admin/renderer.php index 5abd08eaebb..daaf68466b1 100644 --- a/admin/renderer.php +++ b/admin/renderer.php @@ -1285,7 +1285,7 @@ class core_admin_renderer extends plugin_renderer_base { if ($unavailable or $unknown) { $out .= $this->output->heading(get_string('misdepsunavail', 'core_plugin')); if ($unknown) { - $out .= $this->output->notification(get_string('misdepsunknownlist', 'core_plugin', implode($unknown, ', '))); + $out .= $this->output->notification(get_string('misdepsunknownlist', 'core_plugin', implode(', ', $unknown))); } if ($unavailable) { $unavailablelist = array(); @@ -1300,7 +1300,7 @@ class core_admin_renderer extends plugin_renderer_base { $unavailablelist[] = $unavailablelistitem; } $out .= $this->output->notification(get_string('misdepsunavaillist', 'core_plugin', - implode($unavailablelist, ', '))); + implode(', ', $unavailablelist))); } $out .= $this->output->container_start('plugins-check-dependencies-actions'); $out .= ' '.html_writer::link(new moodle_url('/admin/tool/installaddon/'), @@ -1420,7 +1420,7 @@ class core_admin_renderer extends plugin_renderer_base { html_writer::div($plugin->name, 'name').' '.html_writer::div($plugin->component, 'component'), $plugin->version->release, $plugin->version->version, - implode($supportedmoodles, ' '), + implode(' ', $supportedmoodles), $info ); } @@ -2011,7 +2011,7 @@ class core_admin_renderer extends plugin_renderer_base { if (empty($CFG->docroot) or $environment_result->plugin) { $report = get_string($stringtouse, 'admin', $rec); } else { - $report = $this->doc_link(join($linkparts, '/'), get_string($stringtouse, 'admin', $rec), true); + $report = $this->doc_link(join('/', $linkparts), get_string($stringtouse, 'admin', $rec), true); } // Enclose report text in div so feedback text will be displayed underneath it. $report = html_writer::div($report); diff --git a/completion/criteria/completion_criteria_activity.php b/completion/criteria/completion_criteria_activity.php index 592c84e8a57..3e43ef1e5c6 100644 --- a/completion/criteria/completion_criteria_activity.php +++ b/completion/criteria/completion_criteria_activity.php @@ -288,7 +288,7 @@ class completion_criteria_activity extends completion_criteria { } } - $details['requirement'] = implode($details['requirement'], ', '); + $details['requirement'] = implode(', ', $details['requirement']); $details['status'] = ''; diff --git a/filter/tex/filter.php b/filter/tex/filter.php index 924837fc499..395638d22b7 100644 --- a/filter/tex/filter.php +++ b/filter/tex/filter.php @@ -160,7 +160,7 @@ class filter_tex extends moodle_text_filter { '\\\\\((.+?)\\\\\)', '\\[tex\\](.+?)\\[\/tex\\]' ); - $megarule = '/' . implode($rules, '|') . '/is'; + $megarule = '/' . implode('|', $rules) . '/is'; preg_match_all($megarule, $text, $matches); for ($i=0; $idisplayvalue = implode($listofgroups, ', '); + $this->displayvalue = implode(', ', $listofgroups); } else { $this->displayvalue = get_string('groupsnone'); } diff --git a/lib/google/readme_moodle.txt b/lib/google/readme_moodle.txt index 15358b7e921..5aae6a3631f 100644 --- a/lib/google/readme_moodle.txt +++ b/lib/google/readme_moodle.txt @@ -38,6 +38,8 @@ Here are the files that we have added. Local changes (to reapply until upstream upgrades contain them): * MDL-67034 php74 compliance fixes + * MDL-67115 php74 implode() compliance fixes. This is fixed in upstream library v2.2.4 + (verify that https://github.com/googleapis/google-api-php-client/pull/1683 is applied) Information diff --git a/lib/google/src/Google/Http/REST.php b/lib/google/src/Google/Http/REST.php index 491c06846e6..b6900461ef9 100644 --- a/lib/google/src/Google/Http/REST.php +++ b/lib/google/src/Google/Http/REST.php @@ -170,7 +170,7 @@ class Google_Http_REST } if (count($queryVars)) { - $requestUrl .= '?' . implode($queryVars, '&'); + $requestUrl .= '?' . implode('&', $queryVars); } return $requestUrl; diff --git a/lib/htmlpurifier/HTMLPurifier/Printer/HTMLDefinition.php b/lib/htmlpurifier/HTMLPurifier/Printer/HTMLDefinition.php index 679d19ba3a1..c18cd95d5e2 100644 --- a/lib/htmlpurifier/HTMLPurifier/Printer/HTMLDefinition.php +++ b/lib/htmlpurifier/HTMLPurifier/Printer/HTMLDefinition.php @@ -43,8 +43,8 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer $ret .= $this->element('caption', 'Doctype'); $ret .= $this->row('Name', $doctype->name); $ret .= $this->row('XML', $doctype->xml ? 'Yes' : 'No'); - $ret .= $this->row('Default Modules', implode($doctype->modules, ', ')); - $ret .= $this->row('Default Tidy Modules', implode($doctype->tidyModules, ', ')); + $ret .= $this->row('Default Modules', implode(', ', $doctype->modules)); + $ret .= $this->row('Default Tidy Modules', implode(', ', $doctype->tidyModules)); $ret .= $this->end('table'); return $ret; } diff --git a/lib/htmlpurifier/readme_moodle.txt b/lib/htmlpurifier/readme_moodle.txt index 1195367485d..d0f76044dbf 100644 --- a/lib/htmlpurifier/readme_moodle.txt +++ b/lib/htmlpurifier/readme_moodle.txt @@ -21,3 +21,5 @@ Modifications: Check status of https://github.com/ezyang/htmlpurifier/pull/148 * MDL-67030 applied https://github.com/ezyang/htmlpurifier/pull/224 towards php74 compatibility. +* MDL-67115 applied https://github.com/ezyang/htmlpurifier/pull/243 towards + php74 compatibility. diff --git a/lib/listlib.php b/lib/listlib.php index 25ed2660e4a..67520aebbcd 100644 --- a/lib/listlib.php +++ b/lib/listlib.php @@ -552,7 +552,7 @@ abstract class list_item { } else { $childrenhtml = ''; } - return $this->item_html($extraargs).' '.(join($this->icons, '')).(($childrenhtml !='')?("\n".$childrenhtml):''); + return $this->item_html($extraargs).' '.(join('', $this->icons)).(($childrenhtml !='')?("\n".$childrenhtml):''); } public function set_icon_html($first, $last, $lastitem) { diff --git a/lib/minify/matthiasmullie-minify/src/CSS.php b/lib/minify/matthiasmullie-minify/src/CSS.php index e5a4669074c..a9a70a0460a 100644 --- a/lib/minify/matthiasmullie-minify/src/CSS.php +++ b/lib/minify/matthiasmullie-minify/src/CSS.php @@ -525,7 +525,7 @@ class CSS extends Minify ); return preg_replace_callback( - '/(?<=[: ])('.implode(array_keys($colors), '|').')(?=[; }])/i', + '/(?<=[: ])('.implode('|', array_keys($colors)).')(?=[; }])/i', function ($match) use ($colors) { return $colors[strtoupper($match[0])]; }, diff --git a/lib/minify/readme_moodle.txt b/lib/minify/readme_moodle.txt index e0785d0b251..9593ad066d5 100644 --- a/lib/minify/readme_moodle.txt +++ b/lib/minify/readme_moodle.txt @@ -8,3 +8,9 @@ mv minify-1.3.51/data /path/to/moodle/lib/minify/matthiasmullie-minify/ 2) Download https://github.com/matthiasmullie/path-converter/archive/1.1.0.zip and unzip mv path-converter-1.1.0/src/ /path/to/moodle/lib/minify/matthiasmullie-pathconverter/ + +Local changes applied: + +MDL-67115: php 74 compliance - implode() params order. Note this has been fixed upstream + by https://github.com/matthiasmullie/minify/pull/300 so, whenever this library is updated + check if the fix is included and remove this note. diff --git a/lib/questionlib.php b/lib/questionlib.php index 8566321a1e1..9fa33f9f2ad 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -1420,7 +1420,7 @@ function question_category_options($contexts, $top = false, $currentcat = 0, foreach ($contexts as $context) { $pcontexts[] = $context->id; } - $contextslist = join($pcontexts, ', '); + $contextslist = join(', ', $pcontexts); $categories = get_categories_for_contexts($contextslist, 'parent, sortorder, name ASC', $top); @@ -2011,7 +2011,7 @@ class question_edit_contexts { */ public function require_one_cap($caps) { if (!$this->have_one_cap($caps)) { - $capsstring = join($caps, ', '); + $capsstring = join(', ', $caps); print_error('nopermissions', '', '', $capsstring); } } diff --git a/lib/tests/behat/behat_navigation.php b/lib/tests/behat/behat_navigation.php index 58abfafc836..52760799bb0 100644 --- a/lib/tests/behat/behat_navigation.php +++ b/lib/tests/behat/behat_navigation.php @@ -300,7 +300,7 @@ class behat_navigation extends behat_base { // Throw exception if no node found. if (!$nodetoclick) { throw new ExpectationException('Navigation node "' . $nodetext . '" not found under "' . - implode($parentnodes, ' > ') . '"', $this->getSession()); + implode(' > ', $parentnodes) . '"', $this->getSession()); } $nodetoclick->click(); } diff --git a/lib/tests/other/pdflibtestpage.php b/lib/tests/other/pdflibtestpage.php index 3263829e56b..e4f6fb4d1cd 100644 --- a/lib/tests/other/pdflibtestpage.php +++ b/lib/tests/other/pdflibtestpage.php @@ -104,7 +104,7 @@ if ($getpdf) { } $list[] = $f; } - $c .= implode($list, ', '); + $c .= implode(', ', $list); $c .= '

Note: * Standard core fonts are not embedded in PDF files, PDF viewers are using local fonts.

'; $c .= '

Installed languages and their alphabets

'; diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 2372c35f971..2615e43e456 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -570,13 +570,13 @@ function glossary_print_recent_activity($course, $viewfullnames, $timestart) { $joins = array(' FROM {glossary_entries} ge '); $joins[] = 'JOIN {user} u ON u.id = ge.userid '; - $fromsql = implode($joins, "\n"); + $fromsql = implode("\n", $joins); $params['timestart'] = $timestart; $clausesql = ' WHERE ge.timemodified > :timestart '; if (count($approvals) > 0) { - $approvalsql = 'AND ('. implode($approvals, ' OR ') .') '; + $approvalsql = 'AND ('. implode(' OR ', $approvals) .') '; } else { $approvalsql = ''; } diff --git a/question/editlib.php b/question/editlib.php index d0dfbf87c74..f1360717795 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -490,7 +490,7 @@ function question_build_edit_resources($edittab, $baseurl, $params) { foreach ($contexts->having_one_edit_tab_cap($edittab) as $context){ $contextlistarr[] = "'{$context->id}'"; } - $contextlist = join($contextlistarr, ' ,'); + $contextlist = join(' ,', $contextlistarr); if (!empty($pagevars['cat'])){ $catparts = explode(',', $pagevars['cat']); if (!$catparts[0] || (false !== array_search($catparts[1], $contextlistarr)) || diff --git a/question/format/examview/format.php b/question/format/examview/format.php index e2e1a9af611..e092a877c44 100644 --- a/question/format/examview/format.php +++ b/question/format/examview/format.php @@ -164,7 +164,7 @@ class qformat_examview extends qformat_based_on_xml { $questions = array(); $currentquestion = array(); - $text = implode($lines, ' '); + $text = implode(' ', $lines); $text = $this->cleanunicode($text); $xml = xmlize($text, 0); diff --git a/question/format/examview/tests/examviewformat_test.php b/question/format/examview/tests/examviewformat_test.php index 601650fd27c..ab19677d8a1 100644 --- a/question/format/examview/tests/examviewformat_test.php +++ b/question/format/examview/tests/examviewformat_test.php @@ -252,7 +252,7 @@ class qformat_examview_test extends question_testcase { $lines = $this->make_test_xml(); $importer = new qformat_examview(); - $text = implode($lines, ' '); + $text = implode(' ', $lines); $xml = xmlize($text, 0); $importer->parse_matching_groups($xml['examview']['#']['matching-group']); diff --git a/user/classes/output/user_roles_editable.php b/user/classes/output/user_roles_editable.php index 12fc5c51e7b..4ee19611b61 100644 --- a/user/classes/output/user_roles_editable.php +++ b/user/classes/output/user_roles_editable.php @@ -128,7 +128,7 @@ class user_roles_editable extends \core\output\inplace_editable { } if (!empty($listofroles)) { - $this->displayvalue = implode($listofroles, ', '); + $this->displayvalue = implode(', ', $listofroles); } else if (!empty($roleids) && empty($viewableroleids)) { $this->displayvalue = get_string('novisibleroles', 'role'); } else {