*This message was transferred with a trial version of CommuniGate(tm) Pro*
Hi,

I am sorry I ask this for a second time. 
Come on guys ! I am sure somebody can help, please !!!!

I set my own error handler. It is in a file "general_includes.php"
(please find it below) and all pages do a "require" on it.
It works Ok with the exception of parse errors. They are not trapped by
my error handler (which I know it's the expected behaivor) but they
don't either show up in the browser.

My php.ini file has:
display_errors = On
error_reporting = E_ALL & E_NOTICE

And general_includes.php is:
<?php

// Esto se ejecutara en todos los ficheros que incluyan a este fichero
error_reporting( E_ALL ^ E_NOTICE );
$old_error_handler = set_error_handler("userErrorHandler");

function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars)
{
  $dt = date("d-m-Y H:i:s");

  // Paso del path
  $filename = basename ( $filename );

  // Define an assoc array of error string. In reality the only entries
we should 
  // consider are 2,8,256,512 and 1024
  $errortype = array (
              1   =>  "Error",
              2   =>  "Warning",
              4   =>  "Parsing Error",
              8   =>  "Notice",
              16  =>  "Core Error",
              32  =>  "Core Warning",
              64  =>  "Compile Error",
              128 =>  "Compile Warning",
              256 =>  "User Error",
              512 =>  "User Warning",
              1024=>  "User Notice"
              );

  // Errors for which execution can go on.
  $errores_suaves = array(E_WARNING, E_NOTICE, E_USER_NOTICE);

  $err = "<errorentry>\n";
  $err .= "\t<datetime>".$dt."</datetime>\n";
  $err .= "\t<errornum>".$errno."</errornum>\n";
  $err .= "\t<errortype>".$errortype[$errno]."</errortype>\n";
  $err .= "\t<errormsg>".$errmsg."</errormsg>\n";
  $err .= "\t<scriptname>".$filename."</scriptname>\n";
  $err .= "\t<scriptlinenum>".$linenum."</scriptlinenum>\n";

  $err .= "</errorentry>\n\n";

  // For testing. NOTICE errors do not disturb the browser but are
immediatly shown
  // to the programmer. Remaining errors are displayed in the browser.
  if ( ( $errno == E_USER_NOTICE ) || ( $errno == E_NOTICE ) )
    system ("echo $errno $errortype[$errno] $errmsg $filename $linenum 
| write pedro pts/0" );
  else
    echo "<br>=========><br>$err <br><br>";

  // My own log method, which eventualy sends an email
  logea ( C_ERROR_DEL_HANDLER, 0, $filename, $err );

  // Stop processing if serious error
  if ( ! in_array($errno, $errores_suaves) )
    die("Error Interno. Por favor pruebe más tarde");
 }
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to