From a1592faf5f7c36e5f0fe47fb6026b92882937ed9 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 20 Feb 2023 15:41:04 +0100 Subject: [PATCH 1/1] properly encode special HTML characters in debug mode --- lib-php/DebugHtml.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib-php/DebugHtml.php b/lib-php/DebugHtml.php index 0edc081a..e402654f 100644 --- a/lib-php/DebugHtml.php +++ b/lib-php/DebugHtml.php @@ -135,7 +135,7 @@ class Debug public static function printSQL($sSQL) { - echo '

'.$sSQL.'

'."\n"; + echo '

'.htmlspecialchars($sSQL).'

'."\n"; } private static function outputVar($mVar, $sPreNL) @@ -178,11 +178,12 @@ class Debug } if (is_string($mVar)) { - echo "'$mVar'"; - return strlen($mVar) + 2; + $sOut = "'$mVar'"; + } else { + $sOut = (string)$mVar; } - echo (string)$mVar; - return strlen((string)$mVar); + echo htmlspecialchars($sOut); + return strlen($sOut); } } -- 2.45.1