[wp-trac] [WordPress Trac] #40829: Improve wp_dropdown_languages() so it doesn't print out empty attributes

WordPress Trac noreply at wordpress.org
Sat May 20 17:32:10 UTC 2017


#40829: Improve wp_dropdown_languages() so it doesn't print out empty attributes
--------------------------+-----------------------------
 Reporter:  afercia       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 `wp_dropdown_languages()` takes an array of arguments with some defaults.
 Among them, the arguments related to the `name` and `id` HTML attributes
 [https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/l10n.php?rev=40362#L1119 default to empty string].

 Later on, these attributes are printed out without any check if they're
 empty or not:
 `$output = sprintf( '<select name="%s" id="%s">', esc_attr( $args['name']
 ), esc_attr( $args['id'] ) );`

 The final output might print out empty `name` and `id` attributes if the
 related arguments are not explicitly passed: `<select name="" id="">`,
 which doesn't look right to me.

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


More information about the wp-trac mailing list