mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
get rid of confusing shortcuts
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183650 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
b2434c24f7
commit
5f343aab92
1 changed files with 11 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.27 $ -->
|
||||
<!-- $Revision: 1.28 $ -->
|
||||
<!-- splitted from ./en/functions/errorfunc.xml, last change in rev 1.1 -->
|
||||
<refentry id="function.set-error-handler">
|
||||
<refnamediv>
|
||||
|
@ -133,31 +133,25 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// redefine the user error constants - PHP 4 only
|
||||
define("FATAL", E_USER_ERROR);
|
||||
define("ERROR", E_USER_WARNING);
|
||||
define("WARNING", E_USER_NOTICE);
|
||||
|
||||
// set the error reporting level for this script
|
||||
error_reporting(FATAL | ERROR | WARNING);
|
||||
error_reporting(E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE);
|
||||
|
||||
// error handler function
|
||||
function myErrorHandler($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
switch ($errno) {
|
||||
case FATAL:
|
||||
echo "<b>FATAL</b> [$errno] $errstr<br />\n";
|
||||
case E_USER_ERROR:
|
||||
echo "<b>My ERROR</b> [$errno] $errstr<br />\n";
|
||||
echo " Fatal error in line $errline of file $errfile";
|
||||
echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
|
||||
echo "Aborting...<br />\n";
|
||||
exit(1);
|
||||
break;
|
||||
case ERROR:
|
||||
echo "<b>ERROR</b> [$errno] $errstr<br />\n";
|
||||
case E_USER_WARNING:
|
||||
echo "<b>My WARNING</b> [$errno] $errstr<br />\n";
|
||||
break;
|
||||
case WARNING:
|
||||
echo "<b>WARNING</b> [$errno] $errstr<br />\n";
|
||||
case E_USER_NOTICE:
|
||||
echo "<b>My NOTICE</b> [$errno] $errstr<br />\n";
|
||||
break;
|
||||
default:
|
||||
echo "Unkown error type: [$errno] $errstr<br />\n";
|
||||
|
@ -170,18 +164,18 @@ function scale_by_log($vect, $scale)
|
|||
{
|
||||
if (!is_numeric($scale) || $scale <= 0) {
|
||||
trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale",
|
||||
FATAL);
|
||||
E_USER_ERROR);
|
||||
}
|
||||
|
||||
if (!is_array($vect)) {
|
||||
trigger_error("Incorrect input vector, array of values expected", ERROR);
|
||||
trigger_error("Incorrect input vector, array of values expected", E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
|
||||
for ($i=0; $i<count($vect); $i++) {
|
||||
if (!is_numeric($vect[$i]))
|
||||
trigger_error("Value at position $i is not a number, using 0 (zero)",
|
||||
WARNING);
|
||||
E_USER_NOTICE);
|
||||
$temp[$i] = log($scale) * $vect[$i];
|
||||
}
|
||||
return $temp;
|
||||
|
|
Loading…
Reference in a new issue