Skip to content

Commit

Permalink
Fix #11394: Lost password email not sent when user language is invalid
Browse files Browse the repository at this point in the history
When the language specified in the preferences for a user does not exist
or is otherwise invalid (for example: when updating from previous
versions of MantisBT), the lost password email is not sent to the user.

This is probably because of lang_push( user_pref_get_language( user_id )
) where user_pref_get_language can return false and lang_push expects a
string (or null).
  • Loading branch information
davidhicks committed Feb 8, 2010
1 parent b65591f commit 5f7cef9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/lang_api.php
Expand Up @@ -105,7 +105,7 @@ function lang_get_default() {
}

# Otherwise fall back to default
if( false === $t_lang ) {
if( null === $t_lang ) {
$t_lang = config_get_global( 'default_language' );
}

Expand Down
4 changes: 2 additions & 2 deletions core/user_pref_api.php
Expand Up @@ -516,15 +516,15 @@ function user_pref_get_pref( $p_user_id, $p_pref_name, $p_project_id = ALL_PROJE
* returns user language
* @param int $p_user_id
* @param int $p_project_id
* @return string
* @return string language name or null if invalid language specified
*/
function user_pref_get_language( $p_user_id, $p_project_id = ALL_PROJECTS ) {
$t_prefs = user_pref_get( $p_user_id, $p_project_id );

// ensure the language is a valid one
$t_lang = $t_prefs->language;
if( !lang_language_exists( $t_lang ) ) {
$t_lang = false;
$t_lang = null;
}
return $t_lang;
}
Expand Down

0 comments on commit 5f7cef9

Please sign in to comment.