summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it.class4
1 files changed, 4 insertions, 0 deletions
diff --git a/it.class b/it.class
index ce42027..8ca960d 100644
--- a/it.class
+++ b/it.class
@@ -159,6 +159,10 @@ static function error($p = array())
$p = $origp = (array)$p;
$p['title'] = $p[0] ?: $p['title']; # handle 'it_error' => "oops" that was cast to array on the way
+ foreach (array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10), 1) as $level)
+ if ($level["class"] . $level["type"] . $level["function"] == "it::error")
+ return null; # prevent recursion
+
if (!error_reporting() || $p[0] === false || $p['title'] === false) # called with @ or suppressed
return null;