[wp-trac] [WordPress Trac] #38903: Prevent `update_option()` from updating when the old and new values contain identical objects.

WordPress Trac noreply at wordpress.org
Tue Nov 22 12:12:52 UTC 2016


#38903: Prevent `update_option()` from updating when the old and new values contain
identical objects.
---------------------------+-------------------
 Reporter:  peterwilsoncc  |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  4.8
Component:  General        |    Version:  2.0
 Severity:  normal         |   Keywords:  early
  Focuses:                 |
---------------------------+-------------------
 When an object is included in an option, passing an unchanged value to
 `update_option` will trigger an UPDATE query.

 Given the data below, the `meta_data` will have a different resource ID
 for the old and new values. `$value === $old_value` will always evaluate
 untrue and the database will be updated and the caches cleared.

 {{{
 array(2) {
   ["url"]=>
   string(85) "http://src.wordpress-develop.dev/wp-content/uploads/2016/10
 /cropped-Blurry-Lights.jpg"
   ["meta_data"]=>
   object(stdClass)#370 (3) {
     ["attachment_id"]=>
     int(292)
     ["height"]=>
     int(708)
     ["width"]=>
     int(1260)
   }
 }
 }}}

 Followup from #38866, props due @bradyvercher for finding.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38903>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list