diff --git a/backport-changelog/7.0/10894.md b/backport-changelog/7.0/10894.md index ef7247ad1676ab..b1f27542f1f15f 100644 --- a/backport-changelog/7.0/10894.md +++ b/backport-changelog/7.0/10894.md @@ -6,3 +6,4 @@ https://github.com/WordPress/wordpress-develop/pull/10894 * https://github.com/WordPress/gutenberg/pull/75708 * https://github.com/WordPress/gutenberg/pull/75711 * https://github.com/WordPress/gutenberg/pull/75746 +* https://github.com/WordPress/gutenberg/pull/75869 diff --git a/lib/compat/wordpress-7.0/class-wp-sync-post-meta-storage.php b/lib/compat/wordpress-7.0/class-wp-sync-post-meta-storage.php index d05f41c8469eab..88824a1bc0eb3a 100644 --- a/lib/compat/wordpress-7.0/class-wp-sync-post-meta-storage.php +++ b/lib/compat/wordpress-7.0/class-wp-sync-post-meta-storage.php @@ -213,7 +213,13 @@ private function get_storage_post_id( string $room ): ?int { ) ); - $post_id = array_first( $posts ); + /* + * array_first() is a PHP 8.5 function. WordPress added + * a polyfill in WP 6.9 (see https://core.trac.wordpress.org/ticket/63853). + * Since Gutenberg must support the two most recent WordPress + * versions (currently 6.8+), we cannot rely on it here. + */ + $post_id = $posts[0] ?? null; if ( is_int( $post_id ) ) { self::$storage_post_ids[ $room_hash ] = $post_id; return $post_id;