Ticket #39048: wp_parse_str_undifeied_vars.3.patch
File wp_parse_str_undifeied_vars.3.patch, 2.3 KB (added by , 8 years ago) |
---|
-
src/wp-includes/functions.php
3429 3429 * @return array Merged user defined values with defaults. 3430 3430 */ 3431 3431 function wp_parse_args( $args, $defaults = '' ) { 3432 if ( is_object( $args ) ) 3432 if ( is_object( $args ) ) { 3433 3433 $r = get_object_vars( $args ); 3434 elseif ( is_array( $args ) ) 3434 } elseif ( is_array( $args ) ) { 3435 3435 3436 $r =& $args; 3436 else 3437 } else { 3438 $r = array(); 3437 3439 wp_parse_str( $args, $r ); 3440 } 3438 3441 3442 3439 3443 if ( is_array( $defaults ) ) 3440 3444 return array_merge( $defaults, $r ); 3441 3445 return $r; -
src/wp-includes/general-template.php
3277 3277 // Find the format argument. 3278 3278 $format = explode( '?', str_replace( '%_%', $args['format'], $args['base'] ) ); 3279 3279 $format_query = isset( $format[1] ) ? $format[1] : ''; 3280 $format_args = array(); 3280 3281 wp_parse_str( $format_query, $format_args ); 3281 3282 3282 3283 // Find the query args of the requested URL. 3284 $url_query_args = array(); 3283 3285 wp_parse_str( $url_parts[1], $url_query_args ); 3284 3286 3285 3287 // Remove the format argument from the array of query arguments, to avoid overwriting custom format. -
src/wp-includes/script-loader.php
1030 1030 1031 1031 $parsed = parse_url( $src ); 1032 1032 if ( isset($parsed['query']) && $parsed['query'] ) { 1033 $qv = array(); 1033 1034 wp_parse_str( $parsed['query'], $qv ); 1034 1035 $url = add_query_arg( $qv, $url ); 1035 1036 } -
tests/phpunit/tests/functions.php
35 35 36 36 function test_wp_parse_args_other() { 37 37 $b = true; 38 $s = array(); 38 39 wp_parse_str($b, $s); 39 40 $this->assertEquals($s, wp_parse_args($b)); 40 41 $q = 'x=5&_baba=dudu&'; 42 $ss = array(); 41 43 wp_parse_str($q, $ss); 42 44 $this->assertEquals($ss, wp_parse_args($q)); 43 45 }