Index: src/wp-includes/class-wp-hook.php
===================================================================
--- src/wp-includes/class-wp-hook.php	(revision 55746)
+++ src/wp-includes/class-wp-hook.php	(working copy)
@@ -72,8 +72,12 @@
 	 * @param int      $accepted_args The number of arguments the function accepts.
 	 */
 	public function add_filter( $hook_name, $callback, $priority, $accepted_args ) {
-		$idx = _wp_filter_build_unique_id( $hook_name, $callback, $priority );
+		$idx = self::build_unique_id( $callback );
 
+		if ( ! $idx ) {
+			return false;
+		}
+
 		$priority_existed = isset( $this->callbacks[ $priority ] );
 
 		$this->callbacks[ $priority ][ $idx ] = array(
@@ -177,7 +181,7 @@
 	 * @return bool Whether the callback existed before it was removed.
 	 */
 	public function remove_filter( $hook_name, $callback, $priority ) {
-		$function_key = _wp_filter_build_unique_id( $hook_name, $callback, $priority );
+		$function_key = self::build_unique_id( $callback );
 
 		$exists = isset( $this->callbacks[ $priority ][ $function_key ] );
 
@@ -217,7 +221,7 @@
 			return $this->has_filters();
 		}
 
-		$function_key = _wp_filter_build_unique_id( $hook_name, $callback, false );
+		$function_key = self::build_unique_id( $callback );
 
 		if ( ! $function_key ) {
 			return false;
@@ -433,6 +437,41 @@
 	}
 
 	/**
+	 * Builds a unique string ID for a hook callback function.
+	 *
+	 * Functions and static method callbacks are just returned as strings and
+	 * shouldn't have any speed penalty.
+	 *
+	 * @since 6.3.0
+	 *
+	 * @param string                $hook_name Unused. The name of the filter to build ID for.
+	 * @param callable|string|array $callback  The callback to generate ID for. The callback may
+	 *                                         or may not exist.
+	 * @param int                   $priority  Unused. The order in which the functions
+	 *                                         associated with a particular action are executed.
+	 * @return string Unique function ID for usage as array key.
+	 */
+	private static function build_unique_id( $callback ) {
+		if ( is_string( $callback ) ) {
+			return $callback;
+		}
+
+		if ( is_object( $callback ) ) {
+			return spl_object_id( $callback );
+		}
+
+		$callback = (array) $callback;
+
+		if ( is_object( $callback[0] ) ) {
+			// Object class calling.
+			return spl_object_id( $callback[0] ) . $callback[1];
+		} elseif ( is_string( $callback[0] ) ) {
+			// Static calling.
+			return $callback[0] . $callback[1];
+		}
+	}
+
+	/**
 	 * Determines whether an offset value exists.
 	 *
 	 * @since 4.7.0
Index: src/wp-includes/compat.php
===================================================================
--- src/wp-includes/compat.php	(revision 55746)
+++ src/wp-includes/compat.php	(working copy)
@@ -492,6 +492,20 @@
 	}
 }
 
+if ( ! function_exists( 'spl_object_id' ) ) {
+	/**
+	 * Polyfill for `spl_object_id()` function added in PHP 7.2.
+	 *
+	 * @since 6.3.0
+	 *
+	 * @param object $object The object.
+	 * @return string A string that is unique for each currently existing object and is always the same for each object.
+	 */
+	function spl_object_id( $object ) {
+		return hexdec( substr( spl_object_hash( $x ), 0, 16 ) )
+	}
+}
+
 // IMAGETYPE_WEBP constant is only defined in PHP 7.1 or later.
 if ( ! defined( 'IMAGETYPE_WEBP' ) ) {
 	define( 'IMAGETYPE_WEBP', 18 );
Index: src/wp-includes/deprecated.php
===================================================================
--- src/wp-includes/deprecated.php	(revision 55746)
+++ src/wp-includes/deprecated.php	(working copy)
@@ -4639,3 +4639,49 @@
 function wlwmanifest_link() {
 	_deprecated_function( __FUNCTION__, '6.3.0' );
 }
+
+/**
+ * Builds a unique string ID for a hook callback function.
+ *
+ * Functions and static method callbacks are just returned as strings and
+ * shouldn't have any speed penalty.
+ *
+ * @link https://core.trac.wordpress.org/ticket/3875
+ *
+ * @since 2.2.3
+ * @since 5.3.0 Removed workarounds for spl_object_hash().
+ *              `$hook_name` and `$priority` are no longer used,
+ *              and the function always returns a string.
+ * @deprecated 6.3.0
+ *
+ * @access private
+ *
+ * @param string                $hook_name Unused. The name of the filter to build ID for.
+ * @param callable|string|array $callback  The callback to generate ID for. The callback may
+ *                                         or may not exist.
+ * @param int                   $priority  Unused. The order in which the functions
+ *                                         associated with a particular action are executed.
+ * @return string Unique function ID for usage as array key.
+ */
+function _wp_filter_build_unique_id( $hook_name, $callback, $priority ) {
+	_deprecated_function( __FUNCTION__, '6.3.0' );
+
+	if ( is_string( $callback ) ) {
+		return $callback;
+	}
+
+	if ( is_object( $callback ) ) {
+		// Closures are currently implemented as objects.
+		$callback = array( $callback, '' );
+	} else {
+		$callback = (array) $callback;
+	}
+
+	if ( is_object( $callback[0] ) ) {
+		// Object class calling.
+		return spl_object_hash( $callback[0] ) . $callback[1];
+	} elseif ( is_string( $callback[0] ) ) {
+		// Static calling.
+		return $callback[0] . '::' . $callback[1];
+	}
+}
Index: src/wp-includes/plugin.php
===================================================================
--- src/wp-includes/plugin.php	(revision 55746)
+++ src/wp-includes/plugin.php	(working copy)
@@ -962,46 +962,3 @@
 
 	$wp_filter['all']->do_all_hook( $args );
 }
-
-/**
- * Builds a unique string ID for a hook callback function.
- *
- * Functions and static method callbacks are just returned as strings and
- * shouldn't have any speed penalty.
- *
- * @link https://core.trac.wordpress.org/ticket/3875
- *
- * @since 2.2.3
- * @since 5.3.0 Removed workarounds for spl_object_hash().
- *              `$hook_name` and `$priority` are no longer used,
- *              and the function always returns a string.
- *
- * @access private
- *
- * @param string                $hook_name Unused. The name of the filter to build ID for.
- * @param callable|string|array $callback  The callback to generate ID for. The callback may
- *                                         or may not exist.
- * @param int                   $priority  Unused. The order in which the functions
- *                                         associated with a particular action are executed.
- * @return string Unique function ID for usage as array key.
- */
-function _wp_filter_build_unique_id( $hook_name, $callback, $priority ) {
-	if ( is_string( $callback ) ) {
-		return $callback;
-	}
-
-	if ( is_object( $callback ) ) {
-		// Closures are currently implemented as objects.
-		$callback = array( $callback, '' );
-	} else {
-		$callback = (array) $callback;
-	}
-
-	if ( is_object( $callback[0] ) ) {
-		// Object class calling.
-		return spl_object_hash( $callback[0] ) . $callback[1];
-	} elseif ( is_string( $callback[0] ) ) {
-		// Static calling.
-		return $callback[0] . '::' . $callback[1];
-	}
-}
