Custom Error Handling Class

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
jamiel
Forum Contributor
Posts: 276
Joined: Wed Feb 22, 2006 5:17 am
Location: London, United Kingdom

Custom Error Handling Class

Post by jamiel »

Hi all,

Can someone please enlighten me as to why the following prints the fatal array without var dumping the params?

Code: Select all

#!/usr/bin/php
<?php
class Error_Handler
{
    public static function handle($foo, $bar, $baz, $delta)
    {
        var_dump($foo, $bar, $baz, $delta);
    }
}

set_error_handler(array('Error_Handler', 'handle'), E_ALL);

foo();

Output:

Fatal error: Call to undefined function foo() in /home/jamiel/test.php on line 13
Thanks

Jamie

Edit: Missed a bracket but same problem.
Last edited by jamiel on Fri Jun 29, 2007 3:55 am, edited 2 times in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I believe it's not possible to handle fatal errors using a custom error handler. Not positive though..
Post Reply