fix(audit L5): Sperre verwirft den Options-Cache (alloptions), damit Inventar und design_rev unter der Sperre den gespeicherten Stand lesen

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-20 00:13:08 +02:00
co-authored by Claude Sonnet 5.5
parent 71c2e03c9b
commit c4ee195392
3 changed files with 36 additions and 1 deletions
+5 -1
View File
@@ -15,7 +15,8 @@ defined('ABSPATH') || exit;
* DiviCheckRoute (add_option() reads first and writes after, so two requests could both win; audit L6). A lock
* older than STALE_AFTER seconds (a request that died) is taken over with a conditional UPDATE on the value just
* read, so only one taker wins; release() deletes the row only while it still holds this instance's token, so a
* holder that lost a stale lock cannot free the new holder's.
* holder that lost a stale lock cannot free the new holder's. A taken lock drops the cache of the autoloaded
* options, so the inventory read under the lock (and design_rev) is the stored one.
*/
final class DesignLock
{
@@ -65,6 +66,9 @@ final class DesignLock
}
if ($taken) {
$this->tokens[$option] = $token;
// Audit L5: what the holder reads and rewrites must be the stored state, not the request-start cache
// (autoloaded options like Divi's live in "alloptions"); another writer may have finished since.
wp_cache_delete('alloptions', 'options');
}
return $taken;