diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index ef13b74f0c..d77517f2da 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3400,7 +3400,8 @@ function get_backtrace()
foreach ($backtrace as $trace)
{
// Strip the current directory from path
- $trace['file'] = (empty($trace['file'])) ? '' : phpbb_filter_root_path($trace['file']);
+ $trace['file'] = (empty($trace['file'])) ? '(not given by php)' : htmlspecialchars(phpbb_filter_root_path($trace['file']));
+ $trace['line'] = (empty($trace['line'])) ? '(not given by php)' : $trace['line'];
// Only show function arguments for include etc.
// Other parameters may contain sensible information
@@ -3414,7 +3415,7 @@ function get_backtrace()
$trace['type'] = (!isset($trace['type'])) ? '' : $trace['type'];
$output .= '
';
- $output .= 'FILE: ' . htmlspecialchars($trace['file']) . '
';
+ $output .= 'FILE: ' . $trace['file'] . '
';
$output .= 'LINE: ' . ((!empty($trace['line'])) ? $trace['line'] : '') . '
';
$output .= 'CALL: ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function']);