[wp-trac] [WordPress Trac] #53936: Output of serialize_block_attributes does not match equivalent Gutenberg function

WordPress Trac noreply at wordpress.org
Fri Aug 27 19:08:36 UTC 2021


#53936: Output of serialize_block_attributes does not match equivalent Gutenberg
function
-------------------------------------------------+-------------------------
 Reporter:  kevinfodness                         |       Owner:  desrosj
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  5.8.1
Component:  Editor                               |     Version:  5.3.1
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit      |     Focuses:
  fixed-major                                    |
-------------------------------------------------+-------------------------
Changes (by desrosj):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"51681" 51681]:
 {{{
 #!CommitTicketReference repository="" revision="51681"
 Editor: Ensure block attribute serialization in PHP matches the JavaScript
 equivalent.

 The `serializeAttributes()` function in JavaScript uses `JSON.stringify`,
 which does not encode slashes and unicode characters by default. This
 resulted in the PHP serialization through `json_encode()` producing
 different results.

 This also switches from `json_encode()` to `wp_json_encode()` to prevent
 failures when any non UTF-8 characters are included.

 Props kevinfodness, SergeyBiryukov, timothyblynjacobs.
 Merges [51674] to the 5.8 branch.
 Fixes #53936.
 }}}

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


More information about the wp-trac mailing list