Menu

#14 set_error_handler complains with NULL arugment

open
nobody
None
5
2004-02-27
2004-02-27
Ralfoide
No

I used to get this error message in phpunit's HTML output:

PHP ERROR: set_error_handler() expects argument 1, '', to be a valid callback in phpunit.php at line 241

The problem originates from $old_handler being NULL and PHP 4.3.3 complains when set_error_handler is used with a NULL argument 1, so I fix it by changing this line:

[241] set_error_handler($old_handler); // revert to prior error handler

by this:

if ($old_handler != NULL)
set_error_handler($old_handler); // revert to prior error handler
else
restore_error_handler();

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.