From 71ece1d8d3520cdf2a629e7c4a4aa034d041a4b1 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Tue, 5 Apr 2005 12:00:24 +0000 Subject: [PATCH] Meaningful example different from set_error_handler git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183654 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../functions/restore-error-handler.xml | 50 ++++--------------- 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/reference/errorfunc/functions/restore-error-handler.xml b/reference/errorfunc/functions/restore-error-handler.xml index 03d08c4ffe..a77b211165 100644 --- a/reference/errorfunc/functions/restore-error-handler.xml +++ b/reference/errorfunc/functions/restore-error-handler.xml @@ -1,5 +1,5 @@ - + @@ -27,58 +27,30 @@ trigger_error. - The example below shows the handling of internal exceptions by - triggering errors and handling them with a user defined function. It then - restores the original PHP error handling: - Error handling with <function>set_error_handler</function>, - <function>trigger_error</function> and - <function>restore_error_handler</function> + Decide if <function>unserialize</function> caused an error, then + restore the original error handler. My ERROR [$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 WARNING [$errno] $errstr
\n"; - break; - case E_USER_NOTICE: - echo "My NOTICE [$errno] $errstr
\n"; - break; - default: - echo "My unkown error type: [$errno] $errstr
\n"; - break; - } + echo "Invalid serialized value.\n"; } -set_error_handler("myErrorHandler"); -trigger_error('Test error', E_USER_WARNING); - -restore_error_handler(); // Will restore standard PHP handler -trigger_error('Test error', E_USER_WARNING); +$serialized = 'foo'; +set_error_handler('unserialize_handler'); +$original = unserialize($serialized); +restore_error_handler(); ?> ]]>
- &example.outputs.similar; + &example.outputs;