custom error handling

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mcog_esteban
Forum Contributor
Posts: 127
Joined: Tue Dec 30, 2003 3:28 pm

custom error handling

Post by mcog_esteban »

Hello all.

I'm trying to build a custom error handling class, but there's something i'm probably missing.

if i set the error_reporting to:

Code: Select all

error_reporting(E_ALL^E_NOTICE)
and inside my custom class i have:

Code: Select all

..........
switch ($errno) {
    case E_NOTICE:
            echo "Caught a Notice:";
.......
i can still catch this error although i said to report everything unless E_NOTICE's.

Any way to prevent this ? I would only like to deal with error found in the mask.
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post by Mordred »

RTSM.
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.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Mordred wrote:RTSM.
:rofl:
Post Reply