From: Sarah Hoffmann Date: Mon, 20 Feb 2023 14:41:04 +0000 (+0100) Subject: properly encode special HTML characters in debug mode X-Git-Tag: v4.3.0~96 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/513175ce23674abffdd2ebe59fdb1a600c91cd01?hp=-c properly encode special HTML characters in debug mode --- 513175ce23674abffdd2ebe59fdb1a600c91cd01 diff --git a/lib-php/DebugHtml.php b/lib-php/DebugHtml.php index 5d12be67..2207d529 100644 --- a/lib-php/DebugHtml.php +++ b/lib-php/DebugHtml.php @@ -135,7 +135,7 @@ class Debug public static function printSQL($sSQL) { - echo '

'.date('c').' '.$sSQL.'

'."\n"; + echo '

'.date('c').' '.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); } }