[PHP] Error handler script

2010-10-20 Thread Teto
Hi,

I've been wondering if there was any php project focusing on providing
a neat php error handler ?
Up to now, I've been coding mine but I've seen videos on the web where
a guy was using a really impressive php error_handler. Of course I
could code it but if there was something generic I could use in
different projets,that could be useful.

Thx for any tip

matt

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



[PHP] Error Handler

2005-04-22 Thread Pinoy Ako
I use the example given at http://ph.php.net/manual/en/ref.errorfunc.php
However, when I tried to call an undefined function, I get the normal Fatal 
Error message instead of the custom message I entered in the error handler 
function.


My System Settings:
Apache 2.0.53
PHP version 5.0.4
Windows XP SP2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Error Handler

2005-04-22 Thread Richard Lynch
On Fri, April 22, 2005 3:10 pm, Pinoy Ako said:
 I use the example given at http://ph.php.net/manual/en/ref.errorfunc.php

 However, when I tried to call an undefined function, I get the normal
 Fatal
 Error message instead of the custom message I entered in the error handler
 function.

As the User Contributed notes indicate, *SOME* PHP errors simply cannot be
trapped by your custom error handler.

This may, or may not, be one of those cases.

Is an undefined function one of the examples?  If not, try one of those.

Also, did you remember to call http://php.net/set_error_handler as well as
to define the function?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] error handler

2002-06-04 Thread Gerard Samuel

I got an error handler setup, and Im using trigger_error() to do certain 
things.

function errorhandler($type, $msg, $file, $line)
{
switch ($type)
{
/*
case E_NOTICE:
$exit = FALSE;
break;
*/
case E_USER_WARNING:
pretty_error_display($msg);
$exit = TRUE;
break;

case E_USER_ERROR:
error_display($msg);
break;

default:
return;
}

$date = date('D, M d Y H:i:s');
$msg = sprintf([%s]: %s in %s on line %d\n, $date, $msg, $file, 
$line);
$test = error_log($msg, 3, './error/error.log');

if ($exit === TRUE) exit;
}

When I trigger and error with E_USER_ERROR, it executes error_display() 
but it continues to display the rest of the content for the page.
I thought E_USER_ERROR stops execution of the script.
Thanks for any input.

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



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




RE: [PHP] Error Handler Problem

2002-03-10 Thread S.Murali Krishna


I think I can get something from you..
Here just in short I want to Capture Error of the following, just tell 
me what I have to do for that.

PHP: Fatal Error: Undefined function 'some_non_exi_func()'

Thanks for your reply.


On Sat, 9 Mar 2002, Dan Vande More wrote:

 I'm not understanding completely, but could this have something to do with
 it?
 [quote]
 error_reporting() has no effect if you have defined your own error handler
 with set_error_handler()
 
 [Editor's Note: This is not quite accurate.
 
 E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR and
 E_COMPILE_WARNING error levels will be handled as per the error_reporting
 settings.
 
 All other levels of errors will be passed to the custom error handler
 defined by set_error_handler().
 
 Zeev Suraski suggests that a simple way to use the defined levels of error
 reporting with your custom error handlers is to add the following line to
 the top of your error handling function:
 
 if (!($type  error_reporting())) return;
 
  [EMAIL PROTECTED]]
 [/quote]
 Read:
 http://www.php.net/manual/en/function.error-reporting.php
 
 Dan
 
 -Original Message-
 From: S.Murali Krishna [mailto:[EMAIL PROTECTED]] 
 Sent: Saturday, March 09, 2002 6:43 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Error Handler Problem
 
 
 Hi All,
   I tell my requierment first. Just in short I want to capture a
 error of Undefined Function .so and so... .
   I set Error Handler to
 
   E_ALL  ~E_ERROR and I set my own Error Handler to capture errors
 then I called a Non-Existent Function intentionally.
 
 in this case its not at all capturing the error and silently executing
 the program. 
 
 Can anyone tell me what is the workaround this.
 For clarification here is the code.
 
 ?php
 
 function ErrorHandler($Errcode, $Errmsg )
 {
 print ErrorCode:  . $Errcode  . \n ;
 print ErrorMsg :  . $Errmsg   . \n ;
 
 return false ;
 }
 
 
 error_reporting(E_ALL  ~E_ERROR);
 
 $prev_hand = set_error_handler(ErrorHandler);
 
 // It's always executing if section instead of else.
 
 if(!$prev_hand) {
 print Unable to set error handler\n ;
 } else {
 print Previous Handler . $prev_hand ;
 }
 
 
 ?
 
 
 
 
 [EMAIL PROTECTED]
 ---
 We must use time wisely and forever realize that the time is 
 always ripe to do right.
 
   -- Nelson Mandela
 ---
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

[EMAIL PROTECTED]
---
We must use time wisely and forever realize that the time is 
always ripe to do right.

-- Nelson Mandela
---


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




[PHP] Error Handler Problem

2002-03-09 Thread S.Murali Krishna


Hi All,
I tell my requierment first. Just in short I want to capture a
error of Undefined Function .so and so... .
I set Error Handler to

E_ALL  ~E_ERROR and I set my own Error Handler to capture errors
then I called a Non-Existent Function intentionally.

in this case its not at all capturing the error and silently executing
the program. 

Can anyone tell me what is the workaround this.
For clarification here is the code.

?php

function ErrorHandler($Errcode, $Errmsg )
{
print ErrorCode:  . $Errcode  . \n ;
print ErrorMsg :  . $Errmsg   . \n ;

return false ;
}


error_reporting(E_ALL  ~E_ERROR);

$prev_hand = set_error_handler(ErrorHandler);

// It's always executing if section instead of else.

if(!$prev_hand) {
print Unable to set error handler\n ;
} else {
print Previous Handler . $prev_hand ;
}


?




[EMAIL PROTECTED]
---
We must use time wisely and forever realize that the time is 
always ripe to do right.

-- Nelson Mandela
---


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




RE: [PHP] Error Handler Problem

2002-03-09 Thread Dan Vande More

I'm not understanding completely, but could this have something to do with
it?
[quote]
error_reporting() has no effect if you have defined your own error handler
with set_error_handler()

[Editor's Note: This is not quite accurate.

E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR and
E_COMPILE_WARNING error levels will be handled as per the error_reporting
settings.

All other levels of errors will be passed to the custom error handler
defined by set_error_handler().

Zeev Suraski suggests that a simple way to use the defined levels of error
reporting with your custom error handlers is to add the following line to
the top of your error handling function:

if (!($type  error_reporting())) return;

 [EMAIL PROTECTED]]
[/quote]
Read:
http://www.php.net/manual/en/function.error-reporting.php

Dan

-Original Message-
From: S.Murali Krishna [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, March 09, 2002 6:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Error Handler Problem


Hi All,
I tell my requierment first. Just in short I want to capture a
error of Undefined Function .so and so... .
I set Error Handler to

E_ALL  ~E_ERROR and I set my own Error Handler to capture errors
then I called a Non-Existent Function intentionally.

in this case its not at all capturing the error and silently executing
the program. 

Can anyone tell me what is the workaround this.
For clarification here is the code.

?php

function ErrorHandler($Errcode, $Errmsg )
{
print ErrorCode:  . $Errcode  . \n ;
print ErrorMsg :  . $Errmsg   . \n ;

return false ;
}


error_reporting(E_ALL  ~E_ERROR);

$prev_hand = set_error_handler(ErrorHandler);

// It's always executing if section instead of else.

if(!$prev_hand) {
print Unable to set error handler\n ;
} else {
print Previous Handler . $prev_hand ;
}


?




[EMAIL PROTECTED]
---
We must use time wisely and forever realize that the time is 
always ripe to do right.

-- Nelson Mandela
---


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

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