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

WordPress Trac noreply at wordpress.org
Mon Sep 17 20:30:36 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 dcavins):

 Replying to [comment:20 boonebgorges]:
 > Responding to @dcavins
 https://core.trac.wordpress.org/ticket/42810#comment:12:
 >
 > Hm, the only way I could get any of these tests to fail at all was to
 `register_meta()`. Otherwise the REST API endpoint was ignoring them. See
 [attachment:"42069.4.diff"]. With that change, the tests are now
 failing/passing as expected.

 Yes, the meta was registered in the `setup()` method in the earlier
 patches, like
 https://core.trac.wordpress.org/attachment/ticket/42069/42069.3.diff

 The only advantage over the way you did it was that then the metas are
 created with a sanitization function appropriate to their type. I'll
 attach a patch that adds your JSON string test that _does_ fail for me,
 even though my example didn't (a mystery? ha ha). Thanks for being
 interesting in this issue. It has caused me some problems with moving old
 admin-ajax-reliant code to using the REST API.

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


More information about the wp-trac mailing list