feat: sanitize root folder also in php error messages (#3262)

This commit is contained in:
Dag 2023-03-06 21:47:25 +01:00 committed by GitHub
parent a01c1f6ab0
commit 007f2b2d8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 17 deletions

View file

@ -34,8 +34,12 @@ final class RssBridge
if ((error_reporting() & $code) === 0) {
return false;
}
$text = sprintf('%s at %s line %s', $message, trim_path_prefix($file), $line);
// Drop the current frame
$text = sprintf(
'%s at %s line %s',
sanitize_root($message),
sanitize_root($file),
$line
);
Logger::warning($text);
if (Debug::isEnabled()) {
print sprintf("<pre>%s</pre>\n", e($text));
@ -49,8 +53,8 @@ final class RssBridge
$message = sprintf(
'Fatal Error %s: %s in %s line %s',
$error['type'],
$error['message'],
trim_path_prefix($error['file']),
sanitize_root($error['message']),
sanitize_root($error['file']),
$error['line']
);
Logger::error($message);