[wp-trac] [WordPress Trac] #51108: PHP 8: Incorrect wp_localize_script() usage in wp-admin/edit-form-blocks.php

WordPress Trac noreply at wordpress.org
Sat Aug 22 00:03:18 UTC 2020


#51108: PHP 8: Incorrect wp_localize_script() usage in wp-admin/edit-form-
blocks.php
----------------------------+-----------------------------
 Reporter:  SergeyBiryukov  |       Owner:  SergeyBiryukov
     Type:  defect (bug)    |      Status:  closed
 Priority:  normal          |   Milestone:  5.6
Component:  Editor          |     Version:
 Severity:  normal          |  Resolution:  fixed
 Keywords:  php8            |     Focuses:
----------------------------+-----------------------------
Changes (by SergeyBiryukov):

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


Comment:

 In [changeset:"48841" 48841]:
 {{{
 #!CommitTicketReference repository="" revision="48841"
 Editor: Use `wp_add_inline_script()` instead of `wp_localize_script()` to
 pass the `_wpMetaBoxUrl` value to the `wp-editor` script.

 This fixes a PHP 8 "Only the first byte will be assigned to the string
 offset" warning on Edit Post screen.

 The correct usage of `wp_localize_script()` is to pass an array of data,
 not a string.

 Fixes #51108.
 }}}

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


More information about the wp-trac mailing list