[wp-trac] [WordPress Trac] #33226: wrong $key utilization on WP_Object_Cache::add()

WordPress Trac noreply at wordpress.org
Fri Sep 4 20:24:11 UTC 2015


#33226: wrong $key utilization on WP_Object_Cache::add()
--------------------------+------------------------
 Reporter:  Lotti         |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  4.2.3
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:  multisite
--------------------------+------------------------
Changes (by jeremyfelt):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 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
 to `set()`.

 When `$key` is passed to `set()`, 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()` or `set()` directly, as
 they only need to pass the original key.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33226#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list