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

Projects
None yet
2 participants
@williamdes
Member

williamdes commented May 6, 2018

$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

#14260 Fixed configuration for DefaultLang and Lang
Closes: #14260
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes

This comment has been minimized.

Member

williamdes commented May 7, 2018

@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

3 checks passed

DCO All commits have a DCO sign-off from the author
Details
Scrutinizer Analysis: No new issues – Tests: passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@mauriciofauth mauriciofauth self-assigned this May 7, 2018

@mauriciofauth

This comment has been minimized.

Member

mauriciofauth commented May 7, 2018

Merged, thanks for your contribution!

@mauriciofauth mauriciofauth added this to the 4.8.1 milestone May 7, 2018

@mauriciofauth

This comment has been minimized.

Member

mauriciofauth commented May 7, 2018

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 williamdes:issue-14260-langs-cfg branch May 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment