Skip to content

Commit c74d7be

Browse files
committed
Real-time collaboration: Slash meta key/values for updates and deletes.
Slashes the meta key and meta values when adding or deleting meta data in the `WP_Sync_Post_Meta_Storage` class for real time collaboration. Props peterwilsoncc, westonruter. Fixes #64783. git-svn-id: https://develop.svn.wordpress.org/trunk@61788 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 9ce5419 commit c74d7be

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/wp-includes/collaboration/class-wp-sync-post-meta-storage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function add_update( string $room, $update ): bool {
8585
'value' => $update,
8686
);
8787

88-
return (bool) add_post_meta( $post_id, self::SYNC_UPDATE_META_KEY, $envelope, false );
88+
return (bool) add_post_meta( $post_id, wp_slash( self::SYNC_UPDATE_META_KEY ), wp_slash( $envelope ), false );
8989
}
9090

9191
/**
@@ -162,7 +162,7 @@ public function set_awareness_state( string $room, array $awareness ): bool {
162162
}
163163

164164
// update_post_meta returns false if the value is the same as the existing value.
165-
update_post_meta( $post_id, self::AWARENESS_META_KEY, $awareness );
165+
update_post_meta( $post_id, wp_slash( self::AWARENESS_META_KEY ), wp_slash( $awareness ) );
166166
return true;
167167
}
168168

@@ -305,7 +305,7 @@ public function remove_updates_before_cursor( string $room, int $cursor ): bool
305305
$all_updates = $this->get_all_updates( $room );
306306

307307
// Remove all updates for the room and re-store only those that are newer than the cursor.
308-
if ( ! delete_post_meta( $post_id, self::SYNC_UPDATE_META_KEY ) ) {
308+
if ( ! delete_post_meta( $post_id, wp_slash( self::SYNC_UPDATE_META_KEY ) ) ) {
309309
return false;
310310
}
311311

0 commit comments

Comments
 (0)