[wp-trac] [WordPress Trac] #22233: Multiple calls to update_option with the same array only saves the first time

WordPress Trac noreply at wordpress.org
Sat Oct 20 18:01:06 UTC 2012


#22233: Multiple calls to update_option with the same array only saves the first
time
--------------------------+------------------------------
 Reporter:  exz           |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Cache         |     Version:  3.4.2
 Severity:  minor         |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Changes (by scribu):

 * severity:  normal => minor


Comment:

 Confirmed. It seems this check `if ( $newvalue === $oldvalue )` isn't
 enough. PHP probably just compares the internal object ids, rather than
 the values.

 A possible solution would be to make the cloning recursive:

 {{{
 if ( is_object($newvalue) )
         $newvalue = clone $newvalue;
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22233#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list