WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6637 closed defect (bug) (fixed)

wp_widget_categories() doesn't handle html entities in description

Reported by: guillep2k Owned by: guillep2k
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5
Component: I18N Keywords: has-patch tested
Focuses: Cc:

Description

At wp-includes/widgets.php:694, the following line:

wp_dropdown_categories($cat_args . '&show_option_none= ' . __('Select Category'));

Doesn't handle html entities coming from __() translation, since they contain ampersands. To correct this, we can change it to:

wp_dropdown_categories($cat_args . '&show_option_none= ' . urlencode(__('Select Category')));

This is easily seen in Spanish (es_ES.po file can be found here: http://reyson.re.funpic.de/downloads/wp2.5-es_ES-po.rar), where 'Select Category' translates to 'Seleccionar Categoría'.

Attachments (2)

6637.diff (516 bytes) - added by guillep2k 7 years ago.
6637-array.diff (664 bytes) - added by ryan 7 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 @guillep2k7 years ago

  • Cc guillep2k added
  • Component changed from General to i18n

@guillep2k7 years ago

comment:2 @guillep2k7 years ago

  • Keywords has-patch added
  • Milestone changed from 2.7 to 2.5.2

Added a patch for the proposed change.

comment:3 @guillep2k7 years ago

  • Status changed from new to assigned

comment:4 @guillep2k7 years ago

  • Keywords tested added

Tested the patch in 2.5.1 with LANG = es_ES. The "Select Category" option is translated to "Seleccionar Categoría"; without the patch it's shown as "Seleccionar Categor", as the í is taken as another query variable.

@ryan7 years ago

comment:5 follow-up: @ryan7 years ago

We should use the array calling style to avoid the vagaries of query strings. Try out this patch.

comment:6 in reply to: ↑ 5 @guillep2k7 years ago

Replying to ryan:

We should use the array calling style to avoid the vagaries of query strings. Try out this patch.

New patch works perfect for me. I applied it to 2.5.1, though, which is what my wife has on her blog (not trunk).

comment:7 @ryan7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [7872]) Use array calling style. Props guillep2k for the find. fixes #6637 for trunk

comment:8 @ryan7 years ago

(In [7873]) Use array calling style. Props guillep2k for the find. fixes #6637 for 2.5

comment:9 @ryan7 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

comment:10 @westi7 years ago

  • Milestone changed from 2.9 to 2.6
Note: See TracTickets for help on using tickets.