Skip to content

Commit d07539b

Browse files
committed
Harden reading from mixed awareness updates to ensure array and contain type key
1 parent c766306 commit d07539b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/wp-includes/collaboration/class-wp-http-polling-collaboration-server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,11 +626,11 @@ private function process_collaboration_update( string $room, string $client_id,
626626
* Check for a newer compaction update first. If one exists, skip this
627627
* compaction to avoid overwriting it.
628628
*/
629-
$updates_after_cursor = $this->storage->get_updates_after_cursor( $room, $cursor );
629+
$updates_after_cursor = array_filter( $this->storage->get_updates_after_cursor( $room, $cursor ), 'is_array' );
630630
$has_newer_compaction = false;
631631

632632
foreach ( $updates_after_cursor as $existing ) {
633-
if ( self::UPDATE_TYPE_COMPACTION === $existing['type'] ) {
633+
if ( isset( $existing['type'] ) && self::UPDATE_TYPE_COMPACTION === $existing['type'] ) {
634634
$has_newer_compaction = true;
635635
break;
636636
}

0 commit comments

Comments
 (0)