Make WordPress Core

Ticket #21332: 21332.patch

File 21332.patch, 1.3 KB (added by SergeyBiryukov, 11 years ago)

func_get_args()

  • wp-includes/functions.php

     
    637637 */
    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
    652653        if ( $frag = strstr( $uri, '#' ) )
     
    680681
    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
    690691        foreach ( (array) $qs as $k => $v ) {