Index: wp-includes/plugin.php
===================================================================
--- wp-includes/plugin.php	(revision 17511)
+++ wp-includes/plugin.php	(working copy)
@@ -708,20 +708,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
@@ -729,47 +726,73 @@
  * @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.
- * @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
+	// Closures are currently implemented as objects
+	if ( is_object( $function ) ) 
 		$function = array( $function, '' );
-	} else {
-		$function = (array) $function;
+	
+	// Object Instance / Closure Hook
+	if ( is_object( $function[0] ) ) { 
+		$object_id = wp_object_hash( $function[0] );
+		return $object_id . '::' . $function[1];
 	}
 
-	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;
-			}
+	// Static Class Hook
+	return $callable_name;
+}
 
-			return $obj_idx;
-		}
-	} else if ( is_string($function[0]) ) {
-		// Static Calling
-		return $function[0].$function[1];
+/**
+ * get object hash
+ *
+ * Returns a unique hash per object.
+ *
+ * Proxy function for wordpress installments on servers
+ * with a PHP version < 5.3.0.
+ *
+ * @since 3.2
+ * @param object $object
+ * @return string unique object hash
+ */
+function wp_object_hash( $object ) {
+	static $prefix, $count = 0, $property = '__wphookobjhash__', $spl_function_exists;
+
+	if ( ! isset( $spl_function_exists ) ) 
+		$spl_function_exists = function_exists( 'spl_object_hash' );
+
+	// prefer spl_object_hash if available
+	if ( $spl_function_exists )
+		return spl_object_hash( $object );
+
+	// validate input
+	if ( !is_object( $object ) ) { 
+		trigger_error( __FUNCTION__ . '() expects parameter 1 to be object', E_USER_WARNING );
+		return null;
 	}
+
+	// setup prefix and counter to generate object hash, set it to object if not set
+	if ( ! isset( $prefix ) ) {
+		$prefix = uniqid();
+		$property .= $prefix . '__';
+	}
+	
+	if ( ! isset( $object->$property ) ) 
+		$object->$property = sprintf( '%s-%08d', $prefix , ++$count );
+
+	return $object->$property;
 }
 
 ?>
