Re: Custom error handling
*** R. Rajesh Jeba Anbiah wrote/escribió (9 Aug 2005 04:31:47 -0700):[color=blue]
> So, in your callback function, check if the current error_reporting ()
> level (when the error is triggerred) is 0-- if so, ignore that
> error--so that your @ operator will work.[/color]
I need a deeper look on manual. This piece of code inside my error handler
did the trick:
if(error_report ing()==0){
return;
}
Thanks a lot.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Custom error handling
Collapse
This topic is closed.
X
X
-
Guest replied -
Guest repliedRe: Custom error handling
Alvaro G Vicario wrote:[color=blue]
> I've created my own function for error handling using set_error_handl er().
> My problem is that, when using copy() to copy files, I can't suppress
> system's error messages. So when I'm trying to copy a file that does not
> exist I get two error messages: mine and system's.
>
> I've tried the @ operator with no luck: @copy(...)[/color]
<snip>
<quote src="http://in.php.net/set_error_handl er">
It is important to remember that the standard PHP error handler is
completely bypassed. error_reporting () settings will have no effect and
your error handler will be called regardless - however you are still
able to read the current value of error_reporting and act
appropriately. Of particular note is that this value will be 0 if the
statement that caused the error was prepended by the @ error-control
operator.
</quote>
So, in your callback function, check if the current error_reporting ()
level (when the error is triggerred) is 0-- if so, ignore that
error--so that your @ operator will work.
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com
Leave a comment:
-
Custom error handling
I've created my own function for error handling using set_error_handl er().
My problem is that, when using copy() to copy files, I can't suppress
system's error messages. So when I'm trying to copy a file that does not
exist I get two error messages: mine and system's.
I've tried the @ operator with no luck: @copy(...)
Apart from adding extra checks so copy() never returns an error or using
system(), is there a way to replace all error messages with mine?
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Tags: None
Leave a comment: