Index: wp-includes/widgets.php
===================================================================
--- wp-includes/widgets.php	(revision 6085)
+++ wp-includes/widgets.php	(working copy)
@@ -210,7 +210,14 @@
 		$params = array_merge(array($sidebar), (array) $wp_registered_widgets[$id]['params']);
 
 		// Substitute HTML id and class attributes into before_widget
-		$classname_ = ( is_array($wp_registered_widgets[$id]['classname']) ) ? implode('_', $wp_registered_widgets[$id]['classname']) : $wp_registered_widgets[$id]['classname'];
+		$classname_ = '';
+		foreach ( (array) $wp_registered_widgets[$id]['classname'] as $cn ) {
+			if ( is_string($cn) )
+				$classname_ .= '_' . $cn;
+			elseif ( is_object($cn) )
+				$classname_ .= '_' . get_class($cn);
+		}
+		$classname_ = ltrim($classname_, '_');
 		$params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id, $classname_);
 
 		if ( is_callable($callback) ) {
