[wp-trac] [WordPress Trac] #47928: REST API: 'array' type meta not updating properly

WordPress Trac noreply at wordpress.org
Fri Aug 23 15:15:07 UTC 2019


#47928: REST API: 'array' type meta not updating properly
--------------------------------------+--------------------------------
 Reporter:  caercam                   |       Owner:  TimothyBlynJacobs
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  5.3
Component:  REST API                  |     Version:  trunk
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  rest-api
--------------------------------------+--------------------------------
Changes (by TimothyBlynJacobs):

 * keywords:  needs-patch => has-patch has-unit-tests


Comment:

 Added a patch that checks the meta type before casting to a string. We
 have to cast to a string because the return value for scalar types from
 `get_metadata` will always be a string. And if a sanitize callback turns
 that value into a non-string type, the comparison check would fail.

 This was fixed in #42069 for the REST API. However, it looks like it might
 also need to be fixed in the `update_metadata` primitive. Right now, it
 doesn't get caught by the early same value return check for the same
 reasons. It looks like it is rejected at the database level because when
 the value is stored as a string, there is no change from the original
 value. Though something for another ticket I think.

 Could you give this a test @caercam? Also looping in @kadamwhite.

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


More information about the wp-trac mailing list