Index: wp-includes/plugin.php
===================================================================
--- wp-includes/plugin.php	(revision 15570)
+++ wp-includes/plugin.php	(working copy)
@@ -703,20 +703,17 @@
 /**
  * Build Unique ID for storage and retrieval.
  *
- * The old way to serialize the callback caused issues and this function is the
- * solution. It works by checking for objects and creating an a new property in
- * the class to keep track of the object and new objects of the same class that
- * need to be added.
- *
+ * Every hook callback needs to have a Unique ID to identify it within the 
+ * hook registry, the global array $wp_filter.
+ * 
  * It also allows for the removal of actions and filters for objects after they
- * change class properties. It is possible to include the property $wp_filter_id
- * in your class and set it to "null" or a number to bypass the workaround.
- * However this will prevent you from adding new classes and any new classes
- * will overwrite the previous hook by the same class.
+ * change class properties.
  *
  * Functions and static method callbacks are just returned as strings and
  * shouldn't have any speed penalty.
  *
+ * PHP 5.3 anonymous functions are supported as well.
+ *
  * @package WordPress
  * @subpackage Plugin
  * @access private
@@ -724,48 +721,62 @@
  * @link http://trac.wordpress.org/ticket/3875
  *
  * @global array $wp_filter Storage for all of the filters and actions
- * @param string $tag Used in counting how many hooks were applied
- * @param callback $function Used for creating unique id
- * @param int|bool $priority Used in counting how many hooks were applied.  If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise.
- * @param string $type filter or action
- * @return string|bool Unique ID for usage as array key or false if $priority === false and $function is an object reference, and it does not already have a uniqe id.
+ * @param string $tag Obsolete, kept for backwards compability.
+ * @param callback $function Callback to create Unique ID of.
+ * @param int|bool $priority Obsolete, kept for backwards compability.
+ * @return string|bool Unique ID (string), or false on failure
  */
 function _wp_filter_build_unique_id($tag, $function, $priority) {
-	global $wp_filter;
-	static $filter_id_count = 0;
 
-	if ( is_string($function) )
+	// Ensure that this is in a callable syntax 
+	if ( false === is_callable( $function, true, $callable_name ) )
+		return false;
+
+	// Global function hook or anonymous create_function()-hook.
+	if ( is_string( $function ) )
 		return $function;
 
-	if ( is_object($function) ) {
-		// Closures are currently implemented as objects
-		$function = array( $function, '' );
-	} else {
-		$function = (array) $function;
+	// Closures are currently implemented as objects
+	is_object( $function ) && $function = array( $function, '' );
+	
+	// Object Instance / Closure Hook
+	if ( is_object( $function[0] ) && $object_id = wp_object_hash( $function[0] ) )
+		return $object_id . '->' . $function[1];
+
+	// Static Class Hook
+	return $callable_name;
+}
+
+/**
+ * get object hash
+ *
+ * Returns a unique hash per object.
+ *
+ * Proxy function for wordpress installments on servers
+ * with a PHP version < 5.2.0.
+ *
+ * @since 3.0.2
+ * @note Become deprecated with version 3.2.0 (PHP 5.2 requirements)
+ * @param object $object
+ * @return string unique object hash
+ */
+function wp_object_hash( &$object ) {
+	static $prefix, $count = 0, $property = '__wphookobjhash__';
+
+	if ( !is_object( $object ) ) {
+		trigger_error( __FUNCTION__ . '() expects parameter 1 to be object', E_USER_WARNING );
+		return null;
 	}
 
-	if (is_object($function[0]) ) {
-		// Object Class Calling
-		if ( function_exists('spl_object_hash') ) {
-			return spl_object_hash($function[0]) . $function[1];
-		} else {
-			$obj_idx = get_class($function[0]).$function[1];
-			if ( !isset($function[0]->wp_filter_id) ) {
-				if ( false === $priority )
-					return false;
-				$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : $filter_id_count;
-				$function[0]->wp_filter_id = $filter_id_count;
-				++$filter_id_count;
-			} else {
-				$obj_idx .= $function[0]->wp_filter_id;
-			}
+	// prefer spl_object_hash if available
+	if ( function_exists( 'spl_object_hash' ) )
+		return spl_object_hash( $object );
 
-			return $obj_idx;
-		}
-	} else if ( is_string($function[0]) ) {
-		// Static Calling
-		return $function[0].$function[1];
-	}
+	// create object hash on our own 
+	isset( $prefix ) || ( ( $prefix = uniqid( '' ) ) && $property .= $prefix . '__' );
+	isset( $object->$property ) || ( $object->$property = sprintf( '%s-%08d', $prefix , ++$count ) );
+
+	return $object->$property;
 }
 
 ?>
