diff --git a/src/TamerLib/tm.php b/src/TamerLib/tm.php index da11340..b747864 100644 --- a/src/TamerLib/tm.php +++ b/src/TamerLib/tm.php @@ -293,7 +293,6 @@ self::$supervisor->spawnWorker($path, $count, $channel); } - var_dump('monitoring'); self::monitor(-1); } @@ -586,6 +585,16 @@ throw new RuntimeException(sprintf('Attempting to addFunction() in \'%s\' mode, only workers can preform addFunction().', self::$mode)); } + if (!preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/', $function)) + { + throw new InvalidArgumentException("Invalid function name: $function"); + } + + if(method_exists(__CLASS__, $function)) + { + throw new InvalidArgumentException(sprintf('Attempting to addFunction() with a function name of \'%s\', this is a reserved function name.', $function)); + } + self::$function_pointers[$function] = $callback; }