From c0cabf95b8d09aaa7e7e18f64d355689e9ab0d7a Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 7 Oct 2017 20:00:08 +1100 Subject: [PATCH] Fix #13722 DisableIS is not fully honored Signed-off-by: Madhura Jayaratne --- ChangeLog | 1 + libraries/classes/Charsets.php | 27 ++++++++++++++++++++------- test/classes/CharsetsTest.php | 1 + test/classes/NormalizationTest.php | 1 + test/classes/OperationsTest.php | 1 + test/classes/Rte/RoutinesTest.php | 1 + 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd350b6fb8..adc72084fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,7 @@ phpMyAdmin - ChangeLog - issue #13560 Add support for changing collation for all tables and columns in database - issue #13303 Add support for creating fulltext index from table structure - issue #13711 Lower default value for $cfg['MaxExactCount'] +- issue #13722 DisableIS is not fully honored 4.7.5 (not yet released) - issue #13615 Avoid problems with browsing unknown query types diff --git a/libraries/classes/Charsets.php b/libraries/classes/Charsets.php index ab066b35e2..72deb9d158 100644 --- a/libraries/classes/Charsets.php +++ b/libraries/classes/Charsets.php @@ -65,14 +65,20 @@ class Charsets return; } - $sql = 'SELECT * FROM information_schema.CHARACTER_SETS'; + if ($GLOBALS['cfg']['Server']['DisableIS']) { + $sql = 'SHOW CHARACTER SET'; + } else { + $sql = 'SELECT `CHARACTER_SET_NAME` AS `Charset`,' + . ' `DESCRIPTION` AS `Description`' + . ' FROM `information_schema`.`CHARACTER_SETS`'; + } $res = $GLOBALS['dbi']->query($sql); self::$_charsets = array(); while ($row = $GLOBALS['dbi']->fetchAssoc($res)) { - $name = $row['CHARACTER_SET_NAME']; + $name = $row['Charset']; self::$_charsets[] = $name; - self::$_charsets_descriptions[$name] = $row['DESCRIPTION']; + self::$_charsets_descriptions[$name] = $row['Description']; } $GLOBALS['dbi']->freeResult($res); @@ -91,13 +97,20 @@ class Charsets return; } - $sql = 'SELECT * FROM information_schema.COLLATIONS'; + if ($GLOBALS['cfg']['Server']['DisableIS']) { + $sql = 'SHOW COLLATION'; + } else { + $sql = 'SELECT `CHARACTER_SET_NAME` AS `Charset`,' + . ' `COLLATION_NAME` AS `Collation`, `IS_DEFAULT` AS `Default`' + . ' FROM `information_schema`.`COLLATIONS`'; + } + $res = $GLOBALS['dbi']->query($sql); while ($row = $GLOBALS['dbi']->fetchAssoc($res)) { - $char_set_name = $row['CHARACTER_SET_NAME']; - $name = $row['COLLATION_NAME']; + $char_set_name = $row['Charset']; + $name = $row['Collation']; self::$_collations[$char_set_name][] = $name; - if ($row['IS_DEFAULT'] == 'Yes' || $row['IS_DEFAULT'] == '1') { + if ($row['Default'] == 'Yes' || $row['Default'] == '1') { self::$_default_collations[$char_set_name] = $name; } } diff --git a/test/classes/CharsetsTest.php b/test/classes/CharsetsTest.php index 1d9bf56ef3..64c2378161 100644 --- a/test/classes/CharsetsTest.php +++ b/test/classes/CharsetsTest.php @@ -20,6 +20,7 @@ class CharsetsTest extends TestCase public function setUp() { $GLOBALS['cfg']['DBG']['sql'] = false; + $GLOBALS['cfg']['Server']['DisableIS'] = false; } /** diff --git a/test/classes/NormalizationTest.php b/test/classes/NormalizationTest.php index 485cb65759..97da07dfc8 100644 --- a/test/classes/NormalizationTest.php +++ b/test/classes/NormalizationTest.php @@ -39,6 +39,7 @@ class NormalizationTest extends TestCase $GLOBALS['db'] = 'PMA_db'; $GLOBALS['table'] = 'PMA_table'; $GLOBALS['server'] = 1; + $GLOBALS['cfg']['Server']['DisableIS'] = false; //$_SESSION diff --git a/test/classes/OperationsTest.php b/test/classes/OperationsTest.php index 1367de8d87..bf356df017 100644 --- a/test/classes/OperationsTest.php +++ b/test/classes/OperationsTest.php @@ -40,6 +40,7 @@ class OperationsTest extends TestCase $GLOBALS['col_priv'] = true; $GLOBALS['proc_priv'] = true; $GLOBALS['flush_priv'] = true; + $GLOBALS['cfg']['Server']['DisableIS'] = false; } /** diff --git a/test/classes/Rte/RoutinesTest.php b/test/classes/Rte/RoutinesTest.php index dae098ffdf..5c03c1d795 100644 --- a/test/classes/Rte/RoutinesTest.php +++ b/test/classes/Rte/RoutinesTest.php @@ -36,6 +36,7 @@ class RoutinesTest extends TestCase $GLOBALS['server'] = 0; $GLOBALS['PMA_Types'] = new TypesMySQL(); $GLOBALS['pmaThemePath'] = $GLOBALS['PMA_Theme']->getPath(); + $GLOBALS['cfg']['Server']['DisableIS'] = false; } /**