Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#14260 Fixed configuration for DefaultLang and Lang #14261

Merged
merged 1 commit into from May 7, 2018

Conversation

williamdes
Copy link
Member

$GLOBALS['cfg'] is not set before :

$GLOBALS['PMA_Config']->enableBc();

So $GLOBALS['cfg'] cannot be used in
$language = LanguageManager::getInstance()->selectLanguage();

public function selectLanguage()
{
// check forced language
if (! empty($GLOBALS['cfg']['Lang'])) {
$lang = $this->getLanguage($GLOBALS['cfg']['Lang']);
if ($lang !== false) {
return $lang;
}
$this->_lang_failed_cfg = true;
}

And

if (isset($langs[$GLOBALS['cfg']['DefaultLang']])) {
return $langs[$GLOBALS['cfg']['DefaultLang']];
}
// Fallback to English
return $langs['en'];
}

Solution

Migrate to $GLOBALS['PMA_Config']->get('nameofkey') instead of $GLOBALS['cfg']['nameofkey']

More info

Unit tests never failed because the globals where setup for the test.
I updated the test and added a test case that was not covered (cookie test case)

Closes: #14260

Closes: phpmyadmin#14260
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes
Copy link
Member Author

@MauricioFauth CodeCov seems broken ...
https://codecov.io/gh/phpmyadmin/phpmyadmin/commit/2f84b4034e4c423512029534e7a6132e6f8dc4d3

Should we add php-recode extension ?
PhpMyAdmin\Tests\EncodingTest::testRecode
recode extension missing

@MauricioFauth MauricioFauth merged commit 923157d into phpmyadmin:master May 7, 2018
@MauricioFauth MauricioFauth self-assigned this May 7, 2018
@MauricioFauth
Copy link
Member

Merged, thanks for your contribution!

@MauricioFauth MauricioFauth added this to the 4.8.1 milestone May 7, 2018
@MauricioFauth
Copy link
Member

The test should not fail if the recode extension is missing.
Apparently it was a network error.
WARNING Unable to get report from archive, will try again.
ERROR Max retries exceeded

@williamdes williamdes deleted the issue-14260-langs-cfg branch May 7, 2018 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants