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,47 +721,69 @@
  * @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) )
+	// 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, cast everything 
+	// else into an array.
+	if ( is_object( $function ) ) {
 		$function = array( $function, '' );
 	} else {
 		$function = (array) $function;
 	}
+	
+	// Shortcut bogus values.
+	if ( 2 !== count( $function ) || !is_string( $function[1] ) )
+		return false;
 
-	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;
-			}
+	// Class and Object Hooks.
+	if ( is_object( $function[0] ) ) {
+		// Object Instance Hook.
+		$object_id = spl_object_hash( $function[0] );
+		return $object_id   . '->' . $function[1];
+	} else if ( is_string( $function[0] ) ) {
+		// Static Class Hook.
+		return $function[0] . '::' . $function[1];
+	}
 
-			return $obj_idx;
+	return false;
+}
+
+/**
+ * spl_object_hash replacement function
+ */
+if ( !function_exists('spl_object_hash') ) {
+	/**
+	 * get object hash
+	 * 
+	 * Replacement function for wordpress installments on servers
+	 * with a PHP version < 5.2.0.
+	 * 
+	 * @param object $object
+	 * @return string unique object hash
+	 */
+	function spl_object_hash( &$object ) {
+		static $prefix, $count = 0;
+		static $propery = '__wphookobjhash__';
+
+		if ( !is_object( $object ) ) {
+			trigger_error( __FUNCTION__ . '() expects parameter 1 to be object', E_USER_WARNING );
+			return null;
 		}
-	} else if ( is_string($function[0]) ) {
-		// Static Calling
-		return $function[0].$function[1];
+
+		isset( $prefix ) || ( ( $prefix = uniqid( '' ) ) && $propery .= $prefix . '__');
+
+		isset( $object->$propery ) || ($object->$propery = sprintf( '%s-%08d', $prefix , ++$count ) );
+
+		return $object->$propery;
 	}
 }
 
