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

WordPress Trac noreply at wordpress.org
Thu Aug 26 19:09:30 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:
---------------------------------------------+----------------------
Changes (by desrosj):

 * owner:  (none) => desrosj
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"51674" 51674]:
 {{{
 #!CommitTicketReference repository="" revision="51674"
 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.
 Fixes #53936.
 }}}

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


More information about the wp-trac mailing list