From d81ae97a311a0e82a5b5f2dea6b75a8e5fdbdd69 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 15 Feb 2021 14:09:26 +0100 Subject: grapheme_substr turns false into "" in php 8; return was not taken --- it.class | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/it.class b/it.class index 67488a0..64a03c1 100644 --- a/it.class +++ b/it.class @@ -157,6 +157,10 @@ static function timerlog($label = '') static function error($p = array(), $extra = null) { $p = $origp = (array)$p; + + if (error_reporting() == @error_reporting() || $p[0] === false || $p['title'] === false) # called with @ or suppressed + return $p['fatal'] ? self::_exit($p) : null; + $p['title'] = $p[0] ?: $p['title']; # handle 'it_error' => "oops" that was cast to array on the way $p['title'] = grapheme_substr($p['title'], 0, 2000); @@ -167,9 +171,6 @@ static function error($p = array(), $extra = null) if ($level["class"] . $level["type"] . $level["function"] == "it::error") return null; # prevent recursion - if (error_reporting() == @error_reporting() || $p[0] === false || $p['title'] === false) # called with @ or suppressed - return $p['fatal'] ? self::_exit($p) : null; - if ($_SERVER['REMOTE_ADDR']) $url = "http://" . it::replace([':443$' => ""], $_SERVER['HTTP_HOST']) . $_SERVER['REQUEST_URI']; # we ignore https for easier debugging else -- cgit v1.2.3