Opened 9 years ago
Closed 9 years ago
#33226 closed defect (bug) (invalid)
wrong $key utilization on WP_Object_Cache::add()
Reported by: | Lotti | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.2.3 |
Component: | General | Keywords: | |
Focuses: | multisite | Cc: |
Description
Hello!
I noticed that the $key parameter is modified (in all of this class methods) in order to work with a multisite installation. that's fine.
But inside the add() method (differently from all the others), this modification is not reassigned to $key but to a new var called $id. $id is tested in _exists method (that's fine too), but suddendly is not used in set method! Instead is replaced by $key var, losing the multisite context (if applied)!
Thank you.
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hi @Lotti, thanks for the report.
In the
add()
method, the assignment of$key
to$id
is temporary and only used to check if data is already set for that key before passing it toset()
.When
$key
is passed toset()
, it is unaltered.set()
then uses the same process to build the final key for multisite if necessary.This avoids confusion from anyone calling
add()
orset()
directly, as they only need to pass the original key.