Make WordPress Core

Changeset 21373


Ignore:
Timestamp:
07/31/2012 03:28:10 PM (11 years ago)
Author:
ryan
Message:

Call func_get_args() once in add_query_arg(). Props SergeyBiryukov. see #21332

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r21298 r21373  
    638638function add_query_arg() {
    639639    $ret = '';
    640     if ( is_array( func_get_arg(0) ) ) {
    641         if ( func_num_args() < 2 || false === func_get_arg( 1 ) )
     640    $args = func_get_args();
     641    if ( is_array( $args[0] ) ) {
     642        if ( count( $args ) < 2 || false === $args[1] )
    642643            $uri = $_SERVER['REQUEST_URI'];
    643644        else
    644             $uri = func_get_arg( 1 );
     645            $uri = $args[1];
    645646    } else {
    646         if ( func_num_args() < 3 || false === func_get_arg( 2 ) )
     647        if ( count( $args ) < 3 || false === $args[2] )
    647648            $uri = $_SERVER['REQUEST_URI'];
    648649        else
    649             $uri = func_get_arg( 2 );
     650            $uri = $args[2];
    650651    }
    651652
     
    681682    wp_parse_str( $query, $qs );
    682683    $qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string
    683     if ( is_array( func_get_arg( 0 ) ) ) {
    684         $kayvees = func_get_arg( 0 );
     684    if ( is_array( $args[0] ) ) {
     685        $kayvees = $args[0];
    685686        $qs = array_merge( $qs, $kayvees );
    686687    } else {
    687         $qs[func_get_arg( 0 )] = func_get_arg( 1 );
     688        $qs[ $args[0] ] = $args[1];
    688689    }
    689690
Note: See TracChangeset for help on using the changeset viewer.