WordPress.org

Make WordPress Core

Ticket #17923: 17923.2.patch

File 17923.2.patch, 1.1 KB (added by kurtpayne, 6 years ago)

s/foreach/array_map/

  • wordpress/wp-includes/functions.php

     
    14281428 * @param mixed $param1 Either newkey or an associative_array
    14291429 * @param mixed $param2 Either newvalue or oldquery or uri
    14301430 * @param mixed $param3 Optional. Old query or uri
     1431 * @param bool $encode Optional.  If true, values will be rawurlencode()'d
    14311432 * @return string New URL query string.
    14321433 */
    14331434function add_query_arg() {
     
    14771478        $qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string
    14781479        if ( is_array( func_get_arg( 0 ) ) ) {
    14791480                $kayvees = func_get_arg( 0 );
     1481                if ( true === @func_get_arg( 3 ) )
     1482                        $kayvees = array_map( 'rawurlencode', $kayvees );
    14801483                $qs = array_merge( $qs, $kayvees );
    14811484        } else {
    1482                 $qs[func_get_arg( 0 )] = func_get_arg( 1 );
     1485                if ( true === @func_get_arg( 3 ) )
     1486                        $qs[func_get_arg( 0 )] = rawurlencode( func_get_arg( 1 ) );
     1487                else
     1488                        $qs[func_get_arg( 0 )] = func_get_arg( 1 );
    14831489        }
    14841490
    14851491        foreach ( (array) $qs as $k => $v ) {