learnweb / moodle-tool_lifecycle

:recycle: Extensible Moodle plugin for managing course life cycles, e.g., deprovisioning
GNU General Public License v3.0
20 stars 32 forks source link

Bug: specificdate-Trigger compares string to int using identical operator "===" leads to wrong triggerresult #147

Closed FelixDiLenarda closed 2 years ago

FelixDiLenarda commented 2 years ago

The specificdate-Trigger gets the dates as strings from the user when setting up a workflow.

To decide when to run the workflow the dates are parsed and compared to 'timelastrun'.

In line 76 in specificdate/lib.php a identical operator is used: else if ($dateparts['mon'] === $lastrun['mon']) {...

$dateparts['mon'] comes from parse_dates($datesraw) in line 110 which doesn't convert the given dates into integer. Since $lastrun['mon'] is represented as integer the else if.. is never true.