From 4cf34b0dba3bcfa1ef743413376066a236b350ac Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Mon, 3 Mar 2025 15:39:36 +0300 Subject: [PATCH] Fixing bug related to possible re-define of tasks --- taskman.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/taskman.inc.php b/taskman.inc.php index 2a27f60..cc9473f 100644 --- a/taskman.inc.php +++ b/taskman.inc.php @@ -293,11 +293,7 @@ function _get_task_candidates() //get tasks defined as closures foreach($TASKMAN_CLOSURES as $name => $args) - { - if(isset($cands[$name])) - throw new Exception("Task '$name' is already defined"); $cands[$name] = $args; - } ksort($cands); @@ -385,6 +381,10 @@ function task($name) { global $TASKMAN_CLOSURES; + //TODO: can it be a feature? + if(isset($TASKMAN_CLOSURES[$name])) + throw new TaskmanException("Task '$name' is already defined"); + $args = func_get_args(); $TASKMAN_CLOSURES[$name] = $args; }