Skip to content

Commit c4d3fe1

Browse files
committed
Real-time collaboration: prevent fall-through in sync polling server.
When a user sends a stale compaction update to WP_HTTP_Polling_Sync_Server, it falls through the switch statement and results in a rest_invalid_update_type error (bad request). This generally has no ill effect since the compaction request is rescinded on the next polling cycle, but it could cause confusion for users who are monitoring client-side requests or server logs. To fix, replace the break after the $has_newer_compaction check with return true so that the stale compaction is silently discarded instead of falling through. Covered by unit test. Developed in: WordPress/wordpress-develop#11118. Syncs: WordPress/gutenberg#76060. Fixes #64781. Props czarate, mindctrl. Built from https://develop.svn.wordpress.org/trunk@61839 git-svn-id: http://core.svn.wordpress.org/trunk@61126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent a67307b commit c4d3fe1

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,10 @@ private function process_sync_update( string $room, int $client_id, int $cursor,
423423

424424
return $this->add_update( $room, $client_id, $type, $data );
425425
}
426-
break;
426+
427+
// Reaching this point means there's a newer compaction, so we can
428+
// silently ignore this one.
429+
return true;
427430

428431
case self::UPDATE_TYPE_SYNC_STEP1:
429432
case self::UPDATE_TYPE_SYNC_STEP2:

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '7.0-beta2-61838';
19+
$wp_version = '7.0-beta2-61839';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)