I18N: Ensure `determine_locale()` does not potentially return an empty string.
Call `get_locale()` as a last resort in case the sanitized locale is an empty string. Also swaps conditionals to cater for more typical use case and adds tests. Follow-up to [55862] Props Cybr, swissspidy. Fixes #58317. Built from https://develop.svn.wordpress.org/trunk@56003 git-svn-id: http://core.svn.wordpress.org/trunk@55515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6efef07ff8
commit
72fda0359f
|
@ -145,12 +145,14 @@ function determine_locale() {
|
|||
} else {
|
||||
$determined_locale = sanitize_locale_name( $_COOKIE['wp_lang'] );
|
||||
}
|
||||
} else if (
|
||||
( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() ) ||
|
||||
is_admin()
|
||||
} elseif (
|
||||
is_admin() ||
|
||||
( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() )
|
||||
) {
|
||||
$determined_locale = get_user_locale();
|
||||
} else {
|
||||
}
|
||||
|
||||
if ( ! $determined_locale ) {
|
||||
$determined_locale = get_locale();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-alpha-56002';
|
||||
$wp_version = '6.3-alpha-56003';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue