Syxton / moodle-block_massaction

THE OFFICIAL Mass Actions block for Moodle 3.9 and beyond
9 stars 14 forks source link

Ad hoc task fail if with error "must be of the type int, null returned" #84

Closed dmitriim closed 10 months ago

dmitriim commented 1 year ago

In some cases duplicate_cm_to_course can return null, but function declares it will return int. That blows up ad hoc task it falis.

b9e118f95c2f:886 2023-09-16 22:14:23 Adhoc task failed: block_massaction\task\duplicate_task,Return value of block_massaction\massactionutils::duplicate_cm_to_course() must be of the type int, null returned
b9e118f95c2f:886 2023-09-16 22:14:23 Backtrace:
b9e118f95c2f:886 2023-09-16 22:14:23 * line 266 of /blocks/massaction/classes/actions.php: call to block_massaction\massactionutils::duplicate_cm_to_course()
b9e118f95c2f:886 2023-09-16 22:14:23 * line 61 of /blocks/massaction/classes/task/duplicate_task.php: call to block_massaction\actions::duplicate_to_course()
b9e118f95c2f:886 2023-09-16 22:14:23 * line 413 of /lib/cronlib.php: call to block_massaction\task\duplicate_task->execute()
b9e118f95c2f:886 2023-09-16 22:14:23 * line 206 of /lib/cronlib.php: call to cron_run_inner_adhoc_task()
b9e118f95c2f:886 2023-09-16 22:14:23 * line 175 of /admin/cli/adhoc_task.php: call to cron_run_adhoc_tasks()
TomoTsuyuki commented 1 year ago

I made PR #91 for this issue. Please review and merge if it's ok.