From bc2ddb548f71b1a822dd03c3bc7c3c0e7cd9b152 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Fri, 14 Mar 2014 13:05:03 +0100 Subject: Events: Trigger a warning if the default action is not callable This adds a warning in the case that the default action is not null but also not callable which can happen when the supplied method is not public. --- inc/events.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/events.php b/inc/events.php index 7f9824f60..318a7617e 100644 --- a/inc/events.php +++ b/inc/events.php @@ -93,7 +93,12 @@ class Doku_Event { */ function trigger($action=null, $enablePrevent=true) { - if (!is_callable($action)) $enablePrevent = false; + if (!is_callable($action)) { + $enablePrevent = false; + if (!is_null($action)) { + trigger_error('The default action of '.$this.' is not null but also not callable. Maybe the method is not public?', E_USER_WARNING); + } + } if ($this->advise_before($enablePrevent) && is_callable($action)) { if (is_array($action)) { -- cgit v1.2.3