[wp-trac] [WordPress Trac] #52534: PHP 8: wp_localize_script() throws a warning if third parameter is a string.

WordPress Trac noreply at wordpress.org
Fri Feb 19 08:59:38 UTC 2021


#52534: PHP 8: wp_localize_script() throws a warning if third parameter is a
string.
-------------------------------------------+------------------------------
 Reporter:  peterwilsoncc                  |       Owner:  (none)
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  Awaiting Review
Component:  Script Loader                  |     Version:
 Severity:  normal                         |  Resolution:
 Keywords:  php8 has-patch has-unit-tests  |     Focuses:
-------------------------------------------+------------------------------

Comment (by jrf):

 Thanks @peterwilsoncc

 The problem is that even with the current patch, the behaviour is changed,
 like I pointed out in
 https://core.trac.wordpress.org/ticket/52534#comment:6.

 What I think we need to do is:
 * Have a clean commit which only adds tests for the existing behaviour
 (which should pass on current `master`).
 * Then have a second commit which adds the `_doing_it_wrong` message and
 adjusts the test to expect that message when appropriate. Other than
 potentially setting a `$unsupported` parameter, the data provider should
 not change in that commit.

 This is similar to how you originally set up your PR, but has become
 muddled now.

 As things stand, the first commit (clean tests) would not pass with the
 current data set.

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


More information about the wp-trac mailing list