mysql version 5.0.45
php 5.2.3
phpmyadmin 2.11.5
if we configure config.inc.php with :
$cfg['Lang'] = 'fr-iso-8859-15';
- expect result :
default langage will be latin1
- actual result (with display_error = E_ALL in php.ini) :
Notice: Undefined index: fr-iso-8859-15 in ..../index.php on line 95
Warning: Cannot modify header information - headers already sent by (output started at ..../index.php:95) in ..../index.php on line 99
if it doesn't break anything i suggest this fix :
in libraries/database_interface.lib.php on line 833
-----------replace----------
// If $lang is defined and we are on MySQL >= 4.1.x,
// we auto-switch the lang to its UTF-8 version(if it exists and user
// didn't force language)
if (!empty($GLOBALS['lang'])
&& (substr($GLOBALS['lang'], -5) != 'utf-8')
&& !isset($GLOBALS['cfg']['Lang'])) {
$lang_utf_8_version =
substr($GLOBALS['lang'], 0, strpos($GLOBALS['lang'], '-'))
. '-utf-8';
if (!empty($GLOBALS['available_languages'][$lang_utf_8_version])) {
$GLOBALS['lang'] = $lang_utf_8_version;
$GLOBALS['charset'] = 'utf-8';
define('PMA_LANG_RELOAD', 1);
}
}
// and we remove the non-UTF-8 choices to avoid confusion
if (!defined('PMA_REMOVED_NON_UTF_8')) {
foreach ($GLOBALS['available_languages'] as $each_lang => $dummy) {
if (substr($each_lang, -5) != 'utf-8') {
unset($GLOBALS['available_languages'][$each_lang]);
}
}
define('PMA_REMOVED_NON_UTF_8', 1);
}
--------by-----------
// If $lang is defined and we are on MySQL >= 4.1.x,
// we auto-switch the lang to its UTF-8 version(if it exists and user
// didn't force language)
if (!empty($GLOBALS['lang'])
&& (substr($GLOBALS['lang'], -5) != 'utf-8')
&& !isset($GLOBALS['cfg']['Lang'])) {
$lang_utf_8_version =
substr($GLOBALS['lang'], 0, strpos($GLOBALS['lang'], '-'))
. '-utf-8';
if (!empty($GLOBALS['available_languages'][$lang_utf_8_version])) {
$GLOBALS['lang'] = $lang_utf_8_version;
$GLOBALS['charset'] = 'utf-8';
define('PMA_LANG_RELOAD', 1);
}
// and we remove the non-UTF-8 choices to avoid confusion if \(\!defined\('PMA\_REMOVED\_NON\_UTF\_8'\)\) \{ foreach \($GLOBALS\['available\_languages'\] as $each\_lang => $dummy\) \{ if \(substr\($each\_lang, -5\) \!= 'utf-8'\) \{ unset\($GLOBALS\['available\_languages'\]\[$each\_lang\]\); \} \} define\('PMA\_REMOVED\_NON\_UTF\_8', 1\); \}
}
Logged In: YES
user_id=210714
Originator: NO
I cannot see a difference with your proposed replacement code and the original, please point me to the different line(s).
Logged In: YES
user_id=2054626
Originator: YES
in the original code the "if (!defined('PMA_REMOVED_NON_UTF_8'))" is outside the "if (!empty($GLOBALS['lang']) && (substr($GLOBALS['lang'], -5) != 'utf-8') && !isset($GLOBALS['cfg']['Lang']))" statement.
in the replacement code it is inside.
Logged In: YES
user_id=210714
Originator: NO
Thanks. I played a bit on the safe side:
http://phpmyadmin.svn.sourceforge.net/viewvc/phpmyadmin/branches/QA_2_11/phpMyAdmin/libraries/database_interface.lib.php?r1=11021&r2=11196