Re: set_error_handler() fails

From: Date: Fri, 05 May 2006 13:08:14 +0000
Subject: Re: set_error_handler() fails
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-235633@lists.php.net to get a copy of this message
icy escribió:
chris smith wrote:
What does your code look like?
I just realized that when called a second time, set_error_handler() returns my custom error handler but it is never triggered. Code looks like this: <?php
    if (set_error_handler('core_error_handler', E_ALL) === NULL)
        echo 'could not set error handler<br />';
    trigger_error('test error');
    var_dump(set_error_handler('core_error_handler', E_ALL));
function core_error_handler($errno, $errstr, $errfile, $errline) {
    echo 'error...';
} ?> This gives me the following output: could not set error handler Notice: test error in /var/www/.../core.inc.php on line 5 core_error_handler Have you thought about the fact that you're pointing to a function that's not been defined yet when the error is triggered?
And set_error_handler() returns NULL because there isn't a previously defined error handler, not because it failed. Hope this helps.

« previous php.general (#235633) next »