Re: set_error_handler() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux