[wp-trac] [WordPress Trac] #50106: `wp_parse_str` as used by `add_query_arg` breaks URLs with the same query var name used multiple times

WordPress Trac noreply at wordpress.org
Wed May 6 16:12:40 UTC 2020


#50106: `wp_parse_str` as used by `add_query_arg` breaks URLs with the same query
var name used multiple times
--------------------------+-----------------------------
 Reporter:  wpsmith       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Formatting    |    Version:  trunk
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 `wp_parse_str` as used by `add_query_arg` breaks URLs with the same query
 var name used multiple times.

 To reproduce the problem, just add this inside any theme or plugin:
 {{{#!php
 <?php
 add_action( 'wp_enqueue_scripts', 'my_google_fonts_enqueue_styles' );
 function my_google_fonts_enqueue_styles() {
         wp_enqueue_style(
                 'my-google-fonts-1234567890',
 'https://fonts.googleapis.com/css2?family=Alex+Brush&family=Open+Sans:wght@400;700;800&display=swap',
                 [],
                 '3.2.0'
         );
 }
 }}}

 The resulting link tag will be:
 {{{
 <link rel='stylesheet' id='my-google-fonts-1234567890'
 href='https://fonts.googleapis.com/css2?family=Open+Sans%3Awght%40400%3B700%3B800&display=swap&ver=3.2.0'
 media='all' />
 }}}

 The expected result is:
 {{{
 <link rel='stylesheet' id='my-google-fonts-1234567890'
 href='https://fonts.googleapis.com/css2?family=Alex+Brush&family=Open+Sans%3Awght%40400%3B700%3B800&display=swap&ver=3.2.0'
 media='all' />
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50106>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list