diff options
26 files changed, 121 insertions, 217 deletions
diff --git a/import.php b/import.php index d5433df99e..dd1b929abb 100644 --- a/import.php +++ b/import.php @@ -569,10 +569,8 @@ if ($file_to_unlink != '') { // Reset charset back, if we did some changes if ($reset_charset) { - $GLOBALS['dbi']->query('SET CHARACTER SET utf8'); - $GLOBALS['dbi']->query( - 'SET SESSION collation_connection =\'' . $collation_connection . '\'' - ); + $GLOBALS['dbi']->query('SET CHARACTER SET ' . $GLOBALS['charset_connection']); + $GLOBALS['dbi']->setCollationConnection($collation_connection); } // Show correct message @@ -85,6 +85,17 @@ if (isset($_POST['set_theme'])) { header('Location: index.php' . Url::getCommonRaw()); exit(); } +// Change collation connection +if (isset($_POST['collation_connection'])) { + $GLOBALS['PMA_Config']->setUserValue( + null, + 'DefaultConnectionCollation', + $_POST['collation_connection'], + 'utf8mb4_unicode_ci' + ); + header('Location: index.php' . Url::getCommonRaw()); + exit(); +} // See FAQ 1.34 @@ -235,7 +246,7 @@ if ($server > 0 || count($cfg['Servers']) > 1 } } // end if echo ' <li id="li_select_mysql_collation" class="no_bullets" >'; - echo ' <form method="post" action="index.php">' , "\n" + echo ' <form class="disableAjax" method="post" action="index.php">' , "\n" . Url::getHiddenInputs(null, null, 4, 'collation_connection') . ' <label for="select_collation_connection">' . "\n" . ' ' . Util::getImage('s_asci') diff --git a/libraries/classes/Config.php b/libraries/classes/Config.php index 9387b89454..0f0aeef973 100644 --- a/libraries/classes/Config.php +++ b/libraries/classes/Config.php @@ -757,8 +757,6 @@ class Config } if (! $this->checkConfigSource()) { - // even if no config file, set collation_connection - $this->checkCollationConnection(); return false; } @@ -834,51 +832,21 @@ class Config $this->checkServers(); - // Handling of the collation must be done after merging of $cfg - // (from config.inc.php) so that $cfg['DefaultConnectionCollation'] - // can have an effect. - $this->checkCollationConnection(); - return true; } /** - * Saves the connection collation - * - * @param array $config_data configuration data from user preferences + * Sets the connection collation * * @return void */ - private function _saveConnectionCollation(array $config_data) + private function _setConnectionCollation() { - // just to shorten the lines - $collation = 'collation_connection'; - if (isset($GLOBALS[$collation]) - && (isset($_COOKIE['pma_collation_connection']) - || isset($_POST[$collation])) + $collation_connection = $this->get('DefaultConnectionCollation'); + if (! empty($collation_connection) + && $collation_connection != $GLOBALS['collation_connection'] ) { - if ((! isset($config_data[$collation]) - && $GLOBALS[$collation] != 'utf8_general_ci') - || isset($config_data[$collation]) - && $GLOBALS[$collation] != $config_data[$collation] - ) { - $this->setUserValue( - null, - $collation, - $GLOBALS[$collation], - 'utf8_general_ci' - ); - } - } else { - // read collation from settings - if (isset($config_data[$collation])) { - $GLOBALS[$collation] - = $config_data[$collation]; - $this->setCookie( - 'pma_collation_connection', - $GLOBALS[$collation] - ); - } + $GLOBALS['dbi']->setCollation($collation_connection); } } @@ -988,8 +956,8 @@ class Config } } - // save connection collation - $this->_saveConnectionCollation($config_data); + // set connection collation + $this->_setConnectionCollation(); } /** @@ -1235,33 +1203,6 @@ class Config } /** - * Sets collation_connection based on user preference. First is checked - * value from request, then cookies with fallback to default. - * - * After setting it here, cookie is set in common.inc.php to persist - * the selection. - * - * @todo check validity of collation string - * - * @return void - */ - public function checkCollationConnection() - { - if (! empty($_REQUEST['collation_connection'])) { - $collation = htmlspecialchars( - strip_tags($_REQUEST['collation_connection']) - ); - } elseif (! empty($_COOKIE['pma_collation_connection'])) { - $collation = htmlspecialchars( - strip_tags($_COOKIE['pma_collation_connection']) - ); - } else { - $collation = $this->get('DefaultConnectionCollation'); - } - $this->set('collation_connection', $collation); - } - - /** * checks if upload is enabled * * @return void @@ -1403,7 +1344,6 @@ class Config $GLOBALS['cfg'] = $this->settings; $GLOBALS['default_server'] = $this->default_server; unset($this->default_server); - $GLOBALS['collation_connection'] = $this->get('collation_connection'); $GLOBALS['is_upload'] = $this->get('enable_upload'); $GLOBALS['max_upload_size'] = $this->get('max_upload_size'); $GLOBALS['is_https'] = $this->get('is_https'); diff --git a/libraries/classes/Config/Descriptions.php b/libraries/classes/Config/Descriptions.php index 97cb9e7b17..70d007bbf0 100644 --- a/libraries/classes/Config/Descriptions.php +++ b/libraries/classes/Config/Descriptions.php @@ -1484,6 +1484,8 @@ class Descriptions return __('Order by'); case 'FontSize_name': return __('Font size'); + case 'DefaultConnectionCollation_name': + return __('Server connection collation'); } return null; } diff --git a/libraries/classes/Config/Forms/User/FeaturesForm.php b/libraries/classes/Config/Forms/User/FeaturesForm.php index 6e8e30d1d1..9a121e9e40 100644 --- a/libraries/classes/Config/Forms/User/FeaturesForm.php +++ b/libraries/classes/Config/Forms/User/FeaturesForm.php @@ -31,6 +31,7 @@ class FeaturesForm extends BaseForm 'Servers/1/hide_db', // saves to Server/hide_db 'MaxDbList', 'MaxTableList', + 'DefaultConnectionCollation', ), 'Text_fields' => array( 'CharEditing', diff --git a/libraries/classes/DatabaseInterface.php b/libraries/classes/DatabaseInterface.php index 759075a1b0..dadc4a26d7 100644 --- a/libraries/classes/DatabaseInterface.php +++ b/libraries/classes/DatabaseInterface.php @@ -1435,46 +1435,13 @@ class DatabaseInterface $default_charset = 'utf8'; $default_collation = 'utf8_general_ci'; } - $collation_connection = $GLOBALS['PMA_Config']->get('collation_connection'); - if (! empty($collation_connection)) { - $this->query( - "SET CHARACTER SET '$default_charset';", - DatabaseInterface::CONNECT_USER, - self::QUERY_STORE - ); - /* Automatically adjust collation if not supported by server */ - if ($default_charset == 'utf8' - && strncmp('utf8mb4_', $collation_connection, 8) == 0 - ) { - $collation_connection = 'utf8_' . substr($collation_connection, 8); - } - $result = $this->tryQuery( - "SET collation_connection = '" - . $this->escapeString($collation_connection, DatabaseInterface::CONNECT_USER) - . "';", - DatabaseInterface::CONNECT_USER, - self::QUERY_STORE - ); - if ($result === false) { - trigger_error( - __('Failed to set configured collation connection!'), - E_USER_WARNING - ); - $this->query( - "SET collation_connection = '" - . $this->escapeString($collation_connection, DatabaseInterface::CONNECT_USER) - . "';", - DatabaseInterface::CONNECT_USER, - self::QUERY_STORE - ); - } - } else { - $this->query( - "SET NAMES '$default_charset' COLLATE '$default_collation';", - DatabaseInterface::CONNECT_USER, - self::QUERY_STORE - ); - } + $GLOBALS['collation_connection'] = $default_collation; + $GLOBALS['charset_connection'] = $default_charset; + $this->query( + "SET NAMES '$default_charset' COLLATE '$default_collation';", + DatabaseInterface::CONNECT_USER, + self::QUERY_STORE + ); /* Locale for messages */ $locale = LanguageManager::getInstance()->getCurrentLanguage()->getMySQLLocale(); @@ -1523,6 +1490,35 @@ class DatabaseInterface } /** + * Sets collation connection for user link + * + * @param string $collation collation to set + */ + public function setCollation($collation) + { + $charset = $GLOBALS['charset_connection']; + /* Automatically adjust collation if not supported by server */ + if ($charset == 'utf8' && strncmp('utf8mb4_', $collation, 8) == 0) { + $collation = 'utf8_' . substr($collation, 8); + } + $result = $this->tryQuery( + "SET collation_connection = '" + . $this->escapeString($collation, DatabaseInterface::CONNECT_USER) + . "';", + DatabaseInterface::CONNECT_USER, + self::QUERY_STORE + ); + if ($result === false) { + trigger_error( + __('Failed to set configured collation connection!'), + E_USER_WARNING + ); + } else { + $GLOBALS['collation_connection'] = $collation; + } + } + + /** * Function called just after a connection to the MySQL database server has * been established. It sets the connection collation, and determines the * version of MySQL which is running. diff --git a/libraries/classes/Header.php b/libraries/classes/Header.php index 6a56b5cc4e..8a3cbdac24 100644 --- a/libraries/classes/Header.php +++ b/libraries/classes/Header.php @@ -219,17 +219,11 @@ class Header $pftext = isset($_SESSION['tmpval']['pftext']) ? $_SESSION['tmpval']['pftext'] : ''; - // not sure when this happens, but it happens - if (! isset($GLOBALS['collation_connection'])) { - $GLOBALS['collation_connection'] = 'utf8_general_ci'; - } - $params = array( 'common_query' => Url::getCommonRaw(), 'opendb_url' => Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabDatabase'], 'database' ), - 'collation_connection' => $GLOBALS['collation_connection'], 'lang' => $GLOBALS['lang'], 'server' => $GLOBALS['server'], 'table' => $table, diff --git a/libraries/classes/Url.php b/libraries/classes/Url.php index 423abd6d0d..36219e17e4 100644 --- a/libraries/classes/Url.php +++ b/libraries/classes/Url.php @@ -57,11 +57,6 @@ class Url if (empty($_COOKIE['pma_lang']) && ! empty($GLOBALS['lang'])) { $params['lang'] = $GLOBALS['lang']; } - if (empty($_COOKIE['pma_collation_connection']) - && ! empty($GLOBALS['collation_connection']) - ) { - $params['collation_connection'] = $GLOBALS['collation_connection']; - } if (! is_array($skip)) { if (isset($params[$skip])) { @@ -217,11 +212,6 @@ class Url if (empty($_COOKIE['pma_lang']) && ! empty($GLOBALS['lang'])) { $params['lang'] = $GLOBALS['lang']; } - if (empty($_COOKIE['pma_collation_connection']) - && ! empty($GLOBALS['collation_connection']) - ) { - $params['collation_connection'] = $GLOBALS['collation_connection']; - } $query = http_build_query($params, null, $separator); diff --git a/libraries/classes/UserPreferences.php b/libraries/classes/UserPreferences.php index 69fd8905dc..3680b31607 100644 --- a/libraries/classes/UserPreferences.php +++ b/libraries/classes/UserPreferences.php @@ -169,7 +169,6 @@ class UserPreferences // whitelist some additional fields which are custom handled $whitelist['ThemeDefault'] = true; $whitelist['lang'] = true; - $whitelist['collation_connection'] = true; $whitelist['Server/hide_db'] = true; $whitelist['Server/only_db'] = true; $whitelist['2fa'] = true; diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 1abd66e263..cb3323afa3 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -176,7 +176,7 @@ if (Core::checkPageValidity($_REQUEST['back'])) { * mis-match does not make sense * * @todo variables should be handled by their respective owners (objects) - * f.e. lang, server, collation_connection in PhpMyAdmin\Config + * f.e. lang, server in PhpMyAdmin\Config */ $token_mismatch = true; @@ -291,12 +291,6 @@ if (! defined('PMA_MINIMUM_COMMON')) { * @todo should be done in PhpMyAdmin\Config */ $GLOBALS['PMA_Config']->setCookie('pma_lang', $GLOBALS['lang']); - if (isset($GLOBALS['collation_connection'])) { - $GLOBALS['PMA_Config']->setCookie( - 'pma_collation_connection', - $GLOBALS['collation_connection'] - ); - } ThemeManager::getInstance()->setThemeCookie(); diff --git a/prefs_manage.php b/prefs_manage.php index a87ec2c63c..740ec36187 100644 --- a/prefs_manage.php +++ b/prefs_manage.php @@ -160,11 +160,6 @@ if (isset($_POST['submit_export']) ) { $params['lang'] = $config['lang']; } - if (isset($config['collation_connection']) - && $config['collation_connection'] != $GLOBALS['collation_connection'] - ) { - $params['collation_connection'] = $config['collation_connection']; - } // save settings $result = UserPreferences::save($cf->getConfigArray()); diff --git a/test/classes/ConfigTest.php b/test/classes/ConfigTest.php index 20e067ff58..e85e3345d6 100644 --- a/test/classes/ConfigTest.php +++ b/test/classes/ConfigTest.php @@ -546,22 +546,6 @@ class ConfigTest extends PmaTestCase } /** - * test for CheckCollationConnection - * - * @return void - */ - public function testCheckCollationConnection() - { - $_REQUEST['collation_connection'] = 'utf-8'; - $this->object->checkCollationConnection(); - - $this->assertEquals( - $_REQUEST['collation_connection'], - $this->object->get('collation_connection') - ); - } - - /** * test for IsHttp * * @return void diff --git a/test/classes/Database/SearchTest.php b/test/classes/Database/SearchTest.php index d60afd3593..d2da90c801 100644 --- a/test/classes/Database/SearchTest.php +++ b/test/classes/Database/SearchTest.php @@ -35,7 +35,6 @@ class SearchTest extends PmaTestCase $this->object = new Search('pma_test'); $GLOBALS['server'] = 0; $GLOBALS['db'] = 'pma'; - $GLOBALS['collation_connection'] = 'utf-8'; //mock DBI $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') @@ -216,14 +215,13 @@ class SearchTest extends PmaTestCase . '</td><td><a name="browse_search" class="ajax browse_results" ' . 'href="sql.php?db=pma&table' . '=table1&goto=db_sql.php&pos=0&is_js_confirmed=0&' - . 'server=0&lang=en&' - . 'collation_connection=utf-8" ' + . 'server=0&lang=en" ' . 'data-browse-sql="column1" data-table-name="table1" ' . '>Browse</a></td><td>' . '<a name="delete_search" class="ajax delete_results" href' . '="sql.php?db=pma&table=table1&goto=db_sql.php&pos=0' . '&is_js_confirmed=0&server=0&' - . 'lang=en&collation_connection=utf-8" ' + . 'lang=en" ' . 'data-delete-sql="column2" ' . 'data-table-name="table1" ' . '>Delete</a></td></tr>' diff --git a/test/classes/DatabaseInterfaceTest.php b/test/classes/DatabaseInterfaceTest.php index 6823c4ed8b..35b236d407 100644 --- a/test/classes/DatabaseInterfaceTest.php +++ b/test/classes/DatabaseInterfaceTest.php @@ -442,6 +442,45 @@ class DatabaseInterfaceTest extends PmaTestCase array('10.1.22-MariaDB-', 100122, 10, false), ); } + + /** + * Tests for DBI::setCollationl() method. + * + * @return void + * @test + */ + public function testSetCollation() + { + $extension = $this->getMockBuilder('PhpMyAdmin\Dbi\DbiDummy') + ->disableOriginalConstructor() + ->getMock(); + $extension->expects($this->any())->method('escapeString') + ->will($this->returnArgument(1)); + + $extension->expects($this->exactly(4)) + ->method('realQuery') + ->withConsecutive( + array("SET collation_connection = 'utf8_czech_ci';"), + array("SET collation_connection = 'utf8mb4_bin_ci';"), + array("SET collation_connection = 'utf8_czech_ci';"), + array("SET collation_connection = 'utf8_bin_ci';") + ) + ->willReturnOnConsecutiveCalls( + true, + true, + true, + true + ); + + $dbi = new DatabaseInterface($extension); + + $GLOBALS['charset_connection'] = 'utf8mb4'; + $dbi->setCollation('utf8_czech_ci'); + $dbi->setCollation('utf8mb4_bin_ci'); + $GLOBALS['charset_connection'] = 'utf8'; + $dbi->setCollation('utf8_czech_ci'); + $dbi->setCollation('utf8mb4_bin_ci'); + } } /** diff --git a/test/classes/Display/ResultsTest.php b/test/classes/Display/ResultsTest.php index f620c358d7..fed7bdb676 100644 --- a/test/classes/Display/ResultsTest.php +++ b/test/classes/Display/ResultsTest.php @@ -43,7 +43,6 @@ class ResultsTest extends PmaTestCase $GLOBALS['PMA_Config'] = new Config(); $GLOBALS['PMA_Config']->enableBc(); $GLOBALS['text_dir'] = 'ltr'; - $GLOBALS['collation_connection'] = 'utf-8'; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') ->disableOriginalConstructor() @@ -965,7 +964,6 @@ class ResultsTest extends PmaTestCase 'routine_name', 'db_routines.php?item_name=circumference&db=data' . '&item_type=FUNCTION&server=0&lang=en' - . '&collation_connection=utf-8' ), array( 'information_schema', @@ -979,7 +977,6 @@ class ResultsTest extends PmaTestCase 'routine_name', 'db_routines.php?item_name=area&db=data' . '&item_type=PROCEDURE&server=0&lang=en' - . '&collation_connection=utf-8' ), array( 'information_schema', @@ -993,7 +990,6 @@ class ResultsTest extends PmaTestCase 'index.php?sql_query=SELECT+%60CHARACTER_SET_NAME%60+FROM+%60info' . 'rmation_schema%60.%60CHARACTER_SETS%60&db=information_schema' . '&test_name=value&server=0&lang=en' - . '&collation_connection=utf-8' ) ); } @@ -1160,7 +1156,6 @@ class ResultsTest extends PmaTestCase . '<input type="hidden" name="db" value="mysql" />' . '<input type="hidden" name="table" value="user" />' . '<input type="hidden" name="lang" value="en" />' - . '<input type="hidden" name="collation_connection" value="utf-8" />' . '<input type="hidden" name="token" value="token" />' . '<input type="hidden" name="sql_query" value="SELECT * FROM `user`" />' . '<input type="hidden" name="pos" value="0" />' @@ -1340,7 +1335,7 @@ class ResultsTest extends PmaTestCase $url_params, null, '<a href="tbl_get_field.php?db=foo&table=bar&server=0' - . '&lang=en&collation_connection=utf-8' + . '&lang=en' . '" class="disableAjax">1001</a>' ), array( @@ -1355,7 +1350,7 @@ class ResultsTest extends PmaTestCase $url_params, null, '<a href="tbl_get_field.php?db=foo&table=bar&server=0' - . '&lang=en&collation_connection=utf-8' + . '&lang=en' . '" class="disableAjax">0x123456</a>' ), array( @@ -1370,7 +1365,7 @@ class ResultsTest extends PmaTestCase $url_params, null, '<a href="tbl_get_field.php?db=foo&table=bar&server=0' - . '&lang=en&collation_connection=utf-8' + . '&lang=en' . '" class="disableAjax">[BLOB - 4 B]</a>' ), array( @@ -1494,7 +1489,6 @@ class ResultsTest extends PmaTestCase '<td class="left hex">' . PHP_EOL . ' <a href="tbl_get_field.php?' . 'db=foo&table=tbl&server=0&lang=en' - . '&collation_connection=utf-8' . '" ' . 'class="disableAjax">[BLOB - 4 B]</a>' . PHP_EOL . '</td>' . PHP_EOL diff --git a/test/classes/FooterTest.php b/test/classes/FooterTest.php index cc98b84427..8eef4a75ed 100644 --- a/test/classes/FooterTest.php +++ b/test/classes/FooterTest.php @@ -47,7 +47,6 @@ class FooterTest extends PmaTestCase $GLOBALS['text_dir'] = 'ltr'; $GLOBALS['PMA_Config'] = new Config(); $GLOBALS['PMA_Config']->enableBc(); - $GLOBALS['collation_connection'] = 'utf8_general_ci'; $GLOBALS['cfg']['Server']['verbose'] = 'verbose host'; $GLOBALS['server'] = '1'; $_GET['reload_left_frame'] = '1'; @@ -155,8 +154,8 @@ class FooterTest extends PmaTestCase $this->assertEquals( '<div id="selflink" class="print_ignore"><a href="index.php?db=&' - . 'table=&server=1&target=&lang=en&collation_connection=' - . 'utf8_general_ci" title="Open new phpMyAdmin window" ' + . 'table=&server=1&target=&lang=en' + . '" title="Open new phpMyAdmin window" ' . 'target="_blank" rel="noopener noreferrer">Open new phpMyAdmin window</a></div>', $this->_callPrivateFunction( '_getSelfLink', @@ -180,8 +179,8 @@ class FooterTest extends PmaTestCase $this->assertEquals( '<div id="selflink" class="print_ignore"><a href="index.php?db=&' - . 'table=&server=1&target=&lang=en&collation_connection=' - . 'utf8_general_ci" title="Open new phpMyAdmin window" ' + . 'table=&server=1&target=&lang=en' + . '" title="Open new phpMyAdmin window" ' . 'target="_blank" rel="noopener noreferrer"><img src="themes/dot.gif" title="Open new ' . 'phpMyAdmin window" alt="Open new phpMyAdmin window" ' . 'class="icon ic_window-new" /></a></div>', diff --git a/test/classes/InsertEditTest.php b/test/classes/InsertEditTest.php index 75e4f2adf3..44eea3babd 100644 --- a/test/classes/InsertEditTest.php +++ b/test/classes/InsertEditTest.php @@ -280,7 +280,6 @@ class InsertEditTest extends TestCase */ public function testShowTypeOrFunction() { - unset($GLOBALS['collation_connection']); $GLOBALS['cfg']['ShowFieldTypesInDataEditView'] = true; $GLOBALS['cfg']['ServerDefault'] = 1; $url_params = array('ShowFunctionFields' => 2); diff --git a/test/classes/MessageTest.php b/test/classes/MessageTest.php index 95a1ab3d96..519bbf26fc 100644 --- a/test/classes/MessageTest.php +++ b/test/classes/MessageTest.php @@ -425,7 +425,6 @@ class MessageTest extends PmaTestCase public function testDecodeBB($actual, $expected) { unset($GLOBALS['server']); - unset($GLOBALS['collation_connection']); $this->assertEquals($expected, Message::decodeBB($actual)); } diff --git a/test/classes/Plugins/Auth/AuthenticationConfigTest.php b/test/classes/Plugins/Auth/AuthenticationConfigTest.php index 3fe0f16e7d..c8cd6ffa7d 100644 --- a/test/classes/Plugins/Auth/AuthenticationConfigTest.php +++ b/test/classes/Plugins/Auth/AuthenticationConfigTest.php @@ -97,7 +97,6 @@ class AuthenticationConfigTest extends PmaTestCase $GLOBALS['error_handler'] = new ErrorHandler; $GLOBALS['cfg']['Servers'] = array(1); $GLOBALS['allowDeny_forbidden'] = false; - $GLOBALS['collation_connection'] = 'utf-8'; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') ->disableOriginalConstructor() @@ -129,8 +128,7 @@ class AuthenticationConfigTest extends PmaTestCase ); $this->assertContains( - '<a href="index.php?server=0&lang=en' - . '&collation_connection=utf-8" ' + '<a href="index.php?server=0&lang=en" ' . 'class="button disableAjax">Retry to connect</a>', $html ); diff --git a/test/classes/Plugins/Auth/AuthenticationCookieTest.php b/test/classes/Plugins/Auth/AuthenticationCookieTest.php index b0e1caa74a..8587d46fad 100644 --- a/test/classes/Plugins/Auth/AuthenticationCookieTest.php +++ b/test/classes/Plugins/Auth/AuthenticationCookieTest.php @@ -371,11 +371,10 @@ class AuthenticationCookieTest extends PmaTestCase $GLOBALS['cfg']['Servers'] = array(1, 2, 3); $GLOBALS['cfg']['Server']['LogoutURL'] = 'https://example.com/logout'; $GLOBALS['cfg']['Server']['auth_type'] = 'cookie'; - $GLOBALS['collation_connection'] = 'utf-8'; $_COOKIE['pmaAuth-2'] = ''; - $this->mockResponse('Location: /phpmyadmin/index.php?server=2&lang=en&collation_connection=utf-8'); + $this->mockResponse('Location: /phpmyadmin/index.php?server=2&lang=en'); $this->object->logOut(); } @@ -727,10 +726,9 @@ class AuthenticationCookieTest extends PmaTestCase $GLOBALS['server'] = 2; $GLOBALS['cfg']['LoginCookieStore'] = true; $GLOBALS['from_cookie'] = false; - $GLOBALS['collation_connection'] = 'utf-8'; $this->mockResponse( - $this->stringContains('&server=2&lang=en&collation_connection=utf-8') + $this->stringContains('&server=2&lang=en') ); $this->object->storeCredentials(); diff --git a/test/classes/SanitizeTest.php b/test/classes/SanitizeTest.php index bf87ef1193..e719b1d6d2 100644 --- a/test/classes/SanitizeTest.php +++ b/test/classes/SanitizeTest.php @@ -50,7 +50,6 @@ class SanitizeTest extends TestCase unset($GLOBALS['server']); unset($GLOBALS['lang']); - unset($GLOBALS['collation_connection']); $this->assertEquals( '<a href="./url.php?url=https%3A%2F%2Fwww.phpmyadmin.net%2F" target="target">link</a>', Sanitize::sanitize('[a@https://www.phpmyadmin.net/@target]link[/a]') diff --git a/test/classes/Server/PrivilegesTest.php b/test/classes/Server/PrivilegesTest.php index 3a9d06ad8e..d3b9d8c16d 100644 --- a/test/classes/Server/PrivilegesTest.php +++ b/test/classes/Server/PrivilegesTest.php @@ -70,7 +70,6 @@ class PrivilegesTest extends TestCase $GLOBALS['server'] = 1; $GLOBALS['hostname'] = "hostname"; $GLOBALS['username'] = "username"; - $GLOBALS['collation_connection'] = "collation_connection"; $GLOBALS['text_dir'] = "text_dir"; $GLOBALS['is_reload_priv'] = true; @@ -2406,14 +2405,12 @@ class PrivilegesTest extends TestCase $this->assertContains('<td>Z</td>', $actual); $this->assertContains( '<a class="ajax" href="server_privileges.php?initial=-&' - . 'server=1&lang=en&collation_connection=' - . 'collation_connection">-</a>', + . 'server=1&lang=en">-</a>', $actual ); $this->assertContains( '<a class="ajax" href="server_privileges.php?initial=%22&' - . 'server=1&lang=en&collation_connection=' - . 'collation_connection">"</a>', + . 'server=1&lang=en">"</a>', $actual ); $this->assertContains('Show all', $actual); diff --git a/test/classes/ThemeManagerTest.php b/test/classes/ThemeManagerTest.php index 9de8994d06..33fd46756f 100644 --- a/test/classes/ThemeManagerTest.php +++ b/test/classes/ThemeManagerTest.php @@ -30,7 +30,6 @@ class ThemeManagerTest extends PmaTestCase $GLOBALS['cfg']['ServerDefault'] = 0; $GLOBALS['server'] = 99; $GLOBALS['PMA_Config'] = new Config(); - $GLOBALS['collation_connection'] = 'utf8_general_ci'; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') ->disableOriginalConstructor() diff --git a/test/classes/ThemeTest.php b/test/classes/ThemeTest.php index 63a3291286..977258bb34 100644 --- a/test/classes/ThemeTest.php +++ b/test/classes/ThemeTest.php @@ -44,7 +44,6 @@ class ThemeTest extends PmaTestCase $GLOBALS['text_dir'] = 'ltr'; include 'themes/pmahomme/layout.inc.php'; $GLOBALS['server'] = '99'; - $GLOBALS['collation_connection'] = 'utf-8'; } /** @@ -294,7 +293,6 @@ class ThemeTest extends PmaTestCase $this->object->getPrintPreview(), '<div class="theme_preview"><h2> (0.0.0.0) </h2><p><a class="take_' . 'theme" name="" href="index.php?set_theme=&server=99&lang=en' - . '&collation_connection=utf-8' . '">No preview available.[ <strong>take it</strong> ]' . '</a></p></div>' ); diff --git a/test/classes/UrlTest.php b/test/classes/UrlTest.php index 56232c1bfa..2bce450315 100644 --- a/test/classes/UrlTest.php +++ b/test/classes/UrlTest.php @@ -26,7 +26,7 @@ class UrlTest extends TestCase */ public function setUp() { - unset($_COOKIE['pma_lang'], $_COOKIE['pma_collation_connection']); + unset($_COOKIE['pma_lang']); } /** @@ -37,14 +37,10 @@ class UrlTest extends TestCase public function testDbOnly() { $GLOBALS['server'] = 'x'; - $GLOBALS['collation_connection'] = 'x'; $GLOBALS['cfg']['ServerDefault'] = 'y'; $separator = Url::getArgSeparator(); - $expected = 'server=x' . htmlentities($separator) - . 'lang=en' . htmlentities($separator) - . 'collation_connection=x' - ; + $expected = 'server=x' . htmlentities($separator) . 'lang=en' ; $expected = '?db=db' . htmlentities($separator) . $expected; @@ -60,14 +56,10 @@ class UrlTest extends TestCase public function testNewStyle() { $GLOBALS['server'] = 'x'; - $GLOBALS['collation_connection'] = 'x'; $GLOBALS['cfg']['ServerDefault'] = 'y'; $separator = Url::getArgSeparator(); - $expected = 'server=x' . htmlentities($separator) - . 'lang=en' . htmlentities($separator) - . 'collation_connection=x' - ; + $expected = 'server=x' . htmlentities($separator) . 'lang=en' ; $expected = '?db=db' . htmlentities($separator) . 'table=table' @@ -84,14 +76,10 @@ class UrlTest extends TestCase public function testWithAlternateDivider() { $GLOBALS['server'] = 'x'; - $GLOBALS['collation_connection'] = 'x'; $GLOBALS['cfg']['ServerDefault'] = 'y'; $separator = Url::getArgSeparator(); - $expected = 'server=x' . $separator - . 'lang=en' . $separator - . 'collation_connection=x' - ; + $expected = 'server=x' . $separator . 'lang=en' ; $expected = '#ABC#db=db' . $separator . 'table=table' . $separator . $expected; @@ -111,14 +99,10 @@ class UrlTest extends TestCase public function testDefault() { $GLOBALS['server'] = 'x'; - $GLOBALS['collation_connection'] = 'x'; $GLOBALS['cfg']['ServerDefault'] = 'y'; $separator = Url::getArgSeparator(); - $expected = '?server=x' . htmlentities($separator) - . 'lang=en' . htmlentities($separator) - . 'collation_connection=x' - ; + $expected = '?server=x' . htmlentities($separator) . 'lang=en' ; $this->assertEquals($expected, Url::getCommon()); } } diff --git a/test/classes/UserPreferencesTest.php b/test/classes/UserPreferencesTest.php index 9264c47161..d3cd41d470 100644 --- a/test/classes/UserPreferencesTest.php +++ b/test/classes/UserPreferencesTest.php @@ -30,7 +30,6 @@ class UserPreferencesTest extends PmaTestCase include 'libraries/config.default.php'; $GLOBALS['server'] = 0; $GLOBALS['PMA_PHP_SELF'] = '/phpmyadmin/'; - $GLOBALS['collation_connection'] = 'utf8_general_ci'; } /** @@ -355,7 +354,7 @@ class UserPreferencesTest extends PmaTestCase { $GLOBALS['lang'] = ''; - $this->mockResponse('Location: /phpmyadmin/file.html?a=b&saved=1&server=0&collation_connection=utf8_general_ci#h+ash'); + $this->mockResponse('Location: /phpmyadmin/file.html?a=b&saved=1&server=0#h+ash'); $GLOBALS['PMA_Config']->set('PmaAbsoluteUri', ''); $GLOBALS['PMA_Config']->set('PMA_IS_IIS', false); |