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

WordPress Trac noreply at wordpress.org
Mon Jul 30 13:53:05 UTC 2018


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

Comment (by MattGeri):

 @flixos90 This is still very much an issue for us in a production
 environment. I've run your tests locally and some of the tests fail for me
 (as expected). By applying the patch I'm attaching
 [attachment:"42069.1.2.diff"] (combination of your tests + a modified fix
 from above), it fixes the issue and the tests pass. Not too sure why
 they're passing on your local without the changes applied, but I've got
 multiple use cases where this bug breaks saving meta because it's not
 unslashed.

 I do however seem to get 2 unrelated test fails when I run them. The
 dataProvider is somehow passing the `test_bad_auth` meta field in to tests
 that expect a 200 response, and the update fails. I'll try look in to this
 when I get some free time.

 @dcavins In the patch I'm attaching [attachment:"42069.1.2.diff"], I've
 applied what I suggested above (only sanitize and unslash the
 `$meta_value` coming in and not the $old_value) and the tests pass. I'm
 not sure why you were only able to get the tests (and boolean use cases)
 to pass by sanitizing the old and new values. We shouldn't need to
 sanitize the old value as the original method in `meta.php` doesn't.

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


More information about the wp-trac mailing list