Skip to content

Commit f471e3c

Browse files
Apply suggestions from code review
Co-authored-by: Weston Ruter <westonruter@gmail.com>
1 parent 9cfc176 commit f471e3c

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,20 @@ private function add_update( string $room, string $client_id, string $type, stri
614614
* } Response data for this room.
615615
*/
616616
private function get_updates( string $room, string $client_id, int $cursor, bool $is_compactor ): array {
617-
$updates_after_cursor = $this->storage->get_updates_after_cursor( $room, $cursor );
617+
$updates_after_cursor = array_filter(
618+
$this->storage->get_updates_after_cursor( $room, $cursor ),
619+
static function ( $update ): bool {
620+
return (
621+
is_array( $update )
622+
&&
623+
isset( $update['client_id'], $update['type'], $update['data'] )
624+
&&
625+
is_string( $update['type'] )
626+
&&
627+
is_string( $update['data'] )
628+
);
629+
}
630+
);
618631
$total_updates = $this->storage->get_update_count( $room );
619632

620633
// Filter out this client's updates, except compaction updates.

0 commit comments

Comments
 (0)