Skip to content

Commit 28d4e3e

Browse files
committed
Callback: removes HTML from error message [Closes nette/mail#54]
1 parent a692561 commit 28d4e3e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Utils/Callback.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ public static function invokeSafe(string $function, array $args, callable $onErr
6868
{
6969
$prev = set_error_handler(function ($severity, $message, $file) use ($onError, &$prev, $function) {
7070
if ($file === __FILE__) {
71-
$msg = preg_replace("#^$function\(.*?\): #", '', $message);
71+
$msg = $message;
72+
if (ini_get('html_errors')) {
73+
$msg = html_entity_decode(strip_tags($msg));
74+
}
75+
$msg = preg_replace("#^$function\(.*?\): #", '', $msg);
7276
if ($onError($msg, $severity) !== false) {
7377
return;
7478
}

0 commit comments

Comments
 (0)