Skip to content

Commit

Permalink
Prevent dynamic property access on classes for PHP 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
justusdieckmann committed Oct 12, 2023
1 parent 2a34021 commit b39f588
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions workflowoverview.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@
$displaytotaltriggered = !empty($triggers);
}

foreach ($triggers as $trigger) {
foreach ($triggers as &$trigger) {
// The array from the DB Function uses ids as keys.
// Mustache cannot handle arrays which have other keys therefore a new array is build.
// FUTURE: Nice to have Icon for each subplugin.

$trigger = (object)(array) $trigger; // Cast to normal object to be able to set dynamic properties.
$actionmenu = new action_menu([
new action_menu_link_secondary(
new moodle_url(urls::EDIT_ELEMENT, ['type' => settings_type::TRIGGER, 'elementid' => $trigger->id]),
Expand All @@ -125,7 +125,8 @@
}
}

foreach ($steps as $step) {
foreach ($steps as &$step) {
$step = (object)(array) $step; // Cast to normal object to be able to set dynamic properties.
$ncourses = $DB->count_records('tool_lifecycle_process',
array('stepindex' => $step->sortindex, 'workflowid' => $workflowid));
$step->numberofcourses = $ncourses;
Expand Down

0 comments on commit b39f588

Please sign in to comment.