respect error_reporting level in ErrorException example (doc bug #68293)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335199 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Peter Cowburn 2014-11-19 16:49:50 +00:00
parent d35ac758b0
commit 6db778461e

View file

@ -84,6 +84,10 @@
<![CDATA[
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting
return;
}
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");
@ -96,12 +100,12 @@ strpos();
&example.outputs.similar;
<screen>
<![CDATA[
Fatal error: Uncaught exception 'ErrorException' with message 'strpos() expects at least 2 parameters, 0 given' in /home/bjori/tmp/ex.php:8
Fatal error: Uncaught exception 'ErrorException' with message 'strpos() expects at least 2 parameters, 0 given' in /home/bjori/tmp/ex.php:12
Stack trace:
#0 [internal function]: exception_error_handler(2, 'strpos() expect...', '/home/bjori/php...', 8, Array)
#1 /home/bjori/php/cleandocs/test.php(8): strpos()
#0 [internal function]: exception_error_handler(2, 'strpos() expect...', '/home/bjori/php...', 12, Array)
#1 /home/bjori/php/cleandocs/test.php(12): strpos()
#2 {main}
thrown in /home/bjori/tmp/ex.php on line 8
thrown in /home/bjori/tmp/ex.php on line 12
]]>
</screen>
</example><!-- }}} -->