summaryrefslogtreecommitdiff
path: root/it_debug.class
diff options
context:
space:
mode:
authorUrban Müller2016-08-16 18:28:19 +0200
committerNathan Gass2016-08-16 18:30:43 +0200
commitfd38f09a146922a899a605bfaf9c562f5ddd310e (patch)
treeb140cc7f08a0e646b39b832b77d0c08474a8c1cd /it_debug.class
parent715b517eca04786afa70a12291e0d6ac67b6da38 (diff)
downloaditools-fd38f09a146922a899a605bfaf9c562f5ddd310e.tar.gz
itools-fd38f09a146922a899a605bfaf9c562f5ddd310e.tar.bz2
itools-fd38f09a146922a899a605bfaf9c562f5ddd310e.zip
handle bad utf8 in ED()
Diffstat (limited to 'it_debug.class')
-rw-r--r--it_debug.class4
1 files changed, 3 insertions, 1 deletions
diff --git a/it_debug.class b/it_debug.class
index 7f51172..3cd3237 100644
--- a/it_debug.class
+++ b/it_debug.class
@@ -75,6 +75,8 @@ static function srcline($stackoffs = 0)
*/
static function dump($args)
{
+ $htmlspecialchars = array("&" => "&amp;", '<' => "&lt;", '>' => "&gt;");
+
if ((preg_match('/csv|txt|gif|jpg/', $_SERVER['PHP_SELF']) || preg_grep('#text/(calendar|css|javascript|json|plain|rfc822|xml)|application/#', headers_list()) || $GLOBALS['debug_edplain']) && !$GLOBALS['debug_edhtml'])
;
else if ($_SERVER['REMOTE_ADDR'])
@@ -137,7 +139,7 @@ static function dump($args)
$item = "$red$item$nored";
if ($htmlok)
- $item = preg_replace("#(https?:)?//[^\s']*#", "<a href='\$0'>\$0</a>", htmlspecialchars($item));
+ $item = preg_replace("#(https?:)?//[^\s']*#", "<a href='\$0'>\$0</a>", strtr($item, $htmlspecialchars)); # htmlspecialchars() does not like bad utf8
if (preg_match('/^[\'"]/', $var))
$r .= "$item ";