properly encode special HTML characters in debug mode

This commit is contained in:
Sarah Hoffmann
2023-02-20 15:41:04 +01:00
parent e56add9888
commit cb66887c3b

View File

@@ -127,7 +127,7 @@ class Debug
public static function printSQL($sSQL) public static function printSQL($sSQL)
{ {
echo '<p><tt><font color="#aaa">'.$sSQL.'</font></tt></p>'."\n"; echo '<p><tt><font color="#aaa">'.htmlspecialchars($sSQL).'</font></tt></p>'."\n";
} }
private static function outputVar($mVar, $sPreNL) private static function outputVar($mVar, $sPreNL)
@@ -170,11 +170,12 @@ class Debug
} }
if (is_string($mVar)) { if (is_string($mVar)) {
echo "'$mVar'"; $sOut = "'$mVar'";
return strlen($mVar) + 2; } else {
$sOut = (string)$mVar;
} }
echo (string)$mVar; echo htmlspecialchars($sOut);
return strlen((string)$mVar); return strlen($sOut);
} }
} }