[wp-trac] [WordPress Trac] #42069: Saving metadata fails (randomly) if equal value already exists

WordPress Trac noreply at wordpress.org
Tue Jun 5 20:35:07 UTC 2018


#42069: Saving metadata fails (randomly) if equal value already exists
--------------------------+------------------------------
 Reporter:  JVel          |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  4.8.2
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  rest-api
--------------------------+------------------------------

Comment (by MattGeri):

 No worries. I think it was actually the other test that would have been
 failing.

 The issue is that `$old_value[0]` gets returned unslashed from
 `get_metadata`, but `$meta_value` is wrapped in slashes earlier in the
 method. So it's trying to compare slashed against unslashed data, which
 the other solution does not take in to account.

 The data in `meta.php > update_metadata()` gets unslashed on line 167 this
 is before the same comparison as the rest function happens to check if an
 update should occur.

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


More information about the wp-trac mailing list