WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #49391


Ignore:
Timestamp:
02/09/2020 11:39:28 PM (21 months ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #49391 – Description

    initial v1  
    11Admittedly I noticed this problem on wp 5.2.5 and I do see that the function has been updated in 5.3 but in in add_query_arg(), this snippet:
    2 
     2{{{
    33if ( is_array( $args[0] ) ) {
    44        foreach ( $args[0] as $k => $v ) {
     
    88        $qs[ $args[0] ] = $args[1]; //this is line 964
    99}
    10 
     10}}}
    1111produces the following error.
    1212
     
    1616
    1717I'm not certain if its a flaw with the logic of the function or if its being called without the proper arguments but a simple fix that I implemented to remove the notice was changing the above snippet to the following:
    18 
     18{{{
    1919if ( is_array( $args[0] ) ) {   
    2020        foreach ( $args[0] as $k => $v ) {     
     
    2424        $qs[ $args[0] ] = $args[1];     
    2525}
    26 
     26}}}
    2727It seems that for some reason it cannot be assumed that $args[1] will always be set.
    2828