Skip to content

Commit 235d84b

Browse files
committed
Safety, possibly not needed.
1 parent b097d00 commit 235d84b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,13 @@ static function ( $update ): bool {
124124
}
125125

126126
public function get_awareness_cache_key( $post_id ) {
127-
return self::AWARENESS_TRANSIENT_PREFIX . '_' . $post_id;
127+
$cache_key = self::AWARENESS_TRANSIENT_PREFIX . '_' . $post_id;
128+
if ( strlen( $cache_key ) <= 172 ) {
129+
// Safe length for a transient key.
130+
return $cache_key;
131+
}
132+
// If the cache key is too long, hash it to ensure it fits within limits.
133+
return md5( $cache_key );
128134
}
129135

130136
/**

0 commit comments

Comments
 (0)