PHP Warning: array_key_exists()...

It took me a while to figure out what was causing the following warning:

[Tue Feb 08 12:22:39 2011] [error] [client XXXX] PHP Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /xxxxxxx/wp-includes/widgets.php on line 858, referer: http://xxxxx/index.php/chat/

When a Site does not have any Widgets in the Sidebar, I get the error message. When I throw a Widget into the Sidebar, then warning disappears.

Is there a better way of coding widgets.php so that I won't get the warning if there's no Widget in the Sidebar?

This post is similar to this:, except I'm not ready to request that feature.

Thanks all!