From 85caf84cd875f557be60ce8a71d19069229122b5 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Tue, 5 Apr 2005 07:16:48 +0000 Subject: [PATCH] Remove confusing constants, fix WS git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183636 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../functions/restore-error-handler.xml | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/reference/errorfunc/functions/restore-error-handler.xml b/reference/errorfunc/functions/restore-error-handler.xml index dfe9787199..eb5bd3b8bf 100644 --- a/reference/errorfunc/functions/restore-error-handler.xml +++ b/reference/errorfunc/functions/restore-error-handler.xml @@ -1,5 +1,5 @@ - + @@ -39,42 +39,37 @@ My FATAL [$errno] $errstr
\n"; - echo " Fatal error in line $errline of file $errfile"; - echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")
\n"; - echo "Aborting...
\n"; - exit(1); - break; - case ERROR: - echo "My ERROR [$errno] $errstr
\n"; - break; - case WARNING: - echo "My WARNING [$errno] $errstr
\n"; - break; - default: - echo "My unkown error type: [$errno] $errstr
\n"; - break; - } + switch ($errno) { + case E_USER_ERROR: + echo "My FATAL [$errno] $errstr
\n"; + echo " Fatal error in line $errline of file $errfile"; + echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")
\n"; + echo "Aborting...
\n"; + exit(1); + break; + case E_USER_WARNING: + echo "My ERROR [$errno] $errstr
\n"; + break; + case E_USER_NOTICE: + echo "My WARNING [$errno] $errstr
\n"; + break; + default: + echo "My unkown error type: [$errno] $errstr
\n"; + break; + } } set_error_handler("myErrorHandler"); -trigger_error('Test error', ERROR); +trigger_error('Test error', E_USER_WARNING); restore_error_handler(); // Will restore standard PHP handler -trigger_error('Test error', ERROR); +trigger_error('Test error', E_USER_WARNING); ?> ]]>