[wp-trac] [WordPress Trac] #46314: JSON strings in postmeta issue

WordPress Trac noreply at wordpress.org
Fri Feb 22 11:02:38 UTC 2019


#46314: JSON strings in postmeta issue
-------------------------+-----------------------------
 Reporter:  Jonua        |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Database     |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 Using and storing data as JSON is becoming more and more widely used. Also
 in the course of the increased future use of JavaScript for the WordPress
 admin area.

 JSON strings could be part of an serialized array in the postmeta database
 value. Unfortunately update_post_metadata() removes all backslashes and
 may destroyes JSON string syntax if protected quotes are included in the
 JSON string.

 In general all stored backslashes in postmeta will removed whether from a
 JSON string or part of an code example value etc. update_post_metadata()
 should not change the value at all. This is what to expect from this and
 any other function that takes a value to store that value in the database.

 update_post_metadata() is used by many plugins and themes without
 providing wp_slash() to the value before. Is there a chance to solve that
 problem?

 Cheers
 Johann

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46314>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list