From f29b00cccf92e39e42a19c069c60764ba8431858 Mon Sep 17 00:00:00 2001 From: Christoph Michael Becker Date: Fri, 11 Sep 2020 12:39:38 +0000 Subject: [PATCH] Improve example regarding valid HTML This integrated user note 125348. Also, there is no need to `break` after `exit`ing. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@350547 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/errorfunc/functions/set-error-handler.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reference/errorfunc/functions/set-error-handler.xml b/reference/errorfunc/functions/set-error-handler.xml index abdd575118..ffe81f9cf0 100644 --- a/reference/errorfunc/functions/set-error-handler.xml +++ b/reference/errorfunc/functions/set-error-handler.xml @@ -230,6 +230,9 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) return false; } + // $errstr may need to be escaped: + $errstr = htmlspecialchars($errstr); + switch ($errno) { case E_USER_ERROR: echo "My ERROR [$errno] $errstr
\n"; @@ -237,7 +240,6 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")
\n"; echo "Aborting...
\n"; exit(1); - break; case E_USER_WARNING: echo "My WARNING [$errno] $errstr
\n";