Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#18460 closed defect (bug) (fixed)

admin css class 'branch-3-2' and locale 'fr_FR'

Reported by: olivm's profile olivM Owned by: ryan's profile ryan
Milestone: 3.3 Priority: normal
Severity: minor Version: 3.2
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

In the backend of WordPress 3.2, there is an issue linked to the use of locale 'fr_FR' when generating the CSS class which define WordPress version.

In french notation, the numeric separator is comma. so on line 90 of file wp-admin/admin-header.php isn't adapted :

$admin_body_class .= ' branch-' . str_replace( '.', '-', floatval( $wp_version ) );

a possible solution :

$admin_body_class .= ' branch-' . str_replace( array('.', ','), '-', floatval( $wp_version ) );

Attachments (1)

18460.patch (672 bytes) - added by SergeyBiryukov 13 years ago.

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
13 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.3

Related: #17496

floatval( $wp_version ) indeed returns 3,3 with French PHP locale.

Attaching a patch.

#2 @dd32
13 years ago

For anyone not aware of why; PHP when running in a locale-specific environment (such as french) will cause some PHP functions to return localised values, in the case of floatval(), it'll return '3,2' rather than 3.2 as PHP uses the locale-specific decimal/thousands markers. (float)'3.14' will also be 3,14, same as printf, same as every other function you can think of. echo intval(10234) can also output as '10,234' in certain locales.

An example of this in action: (Works on most Linux installs)

setlocale(LC_ALL, 'fr_FR');
var_dump( floatval( '3.2') ); //3,2
echo (float)'2' * (float)'1.1'; //2.2 - calculations work as expected as PHP handles it internally, it's purely output which is affected

#3 @ryan
13 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [18608]:

Handle locales that use a comma as a separator when generating version classes. Props olivM. fixes #18460

Note: See TracTickets for help on using tickets.