[wp-trac] [WordPress Trac] #35795: `update_metadata()` double-unslashes meta key when using `add_metadata()`

WordPress Trac noreply at wordpress.org
Thu Feb 11 04:09:17 UTC 2016


#35795: `update_metadata()` double-unslashes meta key when using `add_metadata()`
--------------------------------+------------------------------
 Reporter:  jdgrimes            |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:  trunk
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:
--------------------------------+------------------------------

Comment (by boonebgorges):

 I think you've actually understated the problem. Not only do keys get
 double-slashed when `update_metadata()` falls back on `add_metadata()`,
 but also when `update_metadata()` does its "has anything changed?" check
 by calling `get_metadata()`.

 Until such time as the slashing mess is cleared up, these functions should
 be reworked so that two copies of `$meta_key` are kept internally: one
 that is unslashed (this is the one used for database queries), and one
 that is not-unslashed (this is the one used to pass to other meta API
 functions, and - I think - in cache keys and when concatenating
 filter/action names). This change should be supported by copious tests.

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


More information about the wp-trac mailing list