[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
       
    Thu Sep 10 13:16:31 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:
----------------------------+-----------------------------
Comment (by azaozz):
 Right, using `wp_add_inline_script()` is better in this case.
 However, where is that warning coming from? For back-compat reasons
 `$wp_scripts->localize()` does `foreach ( (array) $l10n as $key => $value
 )`, i.e. it supports passing a string as mentioned in the ticket, and the
 string should be cast to array.
 Does casting to array work in PHP 8.0?
-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51108#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
    
    
More information about the wp-trac
mailing list