WordPress.org

Making WordPress.org

Changeset 5008


Ignore:
Timestamp:
02/24/2017 11:10:13 PM (3 years ago)
Author:
ocean90
Message:

Plugin Directory: Fix two incorrect cases when trying to match a HTTP header to a WordPress locale.

Includes tests.

Props SergeyBiryukov.
Fixes #1850.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-locale-banner.php

    r4223 r5008  
    6969
    7070        // Build a list of WordPress locales which we'll suggest to the user.
    71         $suggest_locales = array_values( array_intersect( $translated_locales, $locales_from_header ) );
     71        $suggest_locales = array_values( array_intersect( $locales_from_header, $translated_locales ) );
    7272        $current_locale_is_suggested = in_array( $current_locale, $suggest_locales );
    7373        $current_locale_is_translated = in_array( $current_locale, $translated_locales );
     
    263263
    264264        foreach ( $available_locales as $locale ) {
    265             list( $lang, ) = preg_split( '/[_-]/', $locale );
    266             if ( $lang ) {
     265            list( $locale_lang, ) = preg_split( '/[_-]/', $locale );
     266            if ( $lang === $locale_lang ) {
    267267                return $locale;
    268268            }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/phpunit/tests/wporg-plugin-api-performance.php

    r4725 r5008  
    33require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
    44
    5 
    65/**
    7  * @test
     6 *
    87 * @group plugins-api
    98 * @group performance
    109 */
    11 
    1210class Tests_Plugins_API_Performance extends WP_UnitTestCase {
    1311
Note: See TracChangeset for help on using the changeset viewer.