From 0dd44d6549cd9aea9169431014c27c61fafd6a90 Mon Sep 17 00:00:00 2001 From: Yaron Shahrabani Date: Wed, 21 Jul 2021 18:52:04 +0000 Subject: [PATCH 01/11] Translated using Weblate (Hebrew) Currently translated at 47.1% (1596 of 3384 strings) [ci skip] Translation: phpMyAdmin/5.1 Translate-URL: https://hosted.weblate.org/projects/phpmyadmin/5-1/he/ Signed-off-by: Yaron Shahrabani --- po/he.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/po/he.po b/po/he.po index 9a0da138bb..65876d2f42 100644 --- a/po/he.po +++ b/po/he.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 5.1.2-dev\n" "Report-Msgid-Bugs-To: translators@phpmyadmin.net\n" "POT-Creation-Date: 2021-06-04 11:50-0300\n" -"PO-Revision-Date: 2021-07-21 16:16+0000\n" +"PO-Revision-Date: 2021-07-22 19:35+0000\n" "Last-Translator: Yaron Shahrabani \n" "Language-Team: Hebrew \n" @@ -17980,13 +17980,13 @@ msgid "at beginning of table" msgstr "בתחילת טבלה" #: templates/table/structure/display_structure.twig:507 -#, fuzzy, php-format +#, php-format msgid "Create an index on %s columns" -msgstr "יצירת אינדקס בעמודות %s" +msgstr "יצירת מפתח על עמודות %s" #: templates/table/structure/display_table_stats.twig:14 msgid "Space usage" -msgstr "שימוש מקום" +msgstr "ניצולת" #: templates/table/structure/display_table_stats.twig:37 msgid "Effective" From a8d9f44f9616c3d9e6d10a3d7560ac75825419f6 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Mon, 26 Jul 2021 18:11:19 +0200 Subject: [PATCH 02/11] Fix #17016, Fix #17037 - Display the error after structure change errored Signed-off-by: William Desportes --- .../classes/Controllers/Table/StructureController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/classes/Controllers/Table/StructureController.php b/libraries/classes/Controllers/Table/StructureController.php index 1ecf764331..f8cf96b48e 100644 --- a/libraries/classes/Controllers/Table/StructureController.php +++ b/libraries/classes/Controllers/Table/StructureController.php @@ -1267,11 +1267,11 @@ class StructureController extends AbstractController $this->dbi->query($revert_query); $this->response->setRequestStatus(false); - $this->response->addJSON( - 'message', - Message::rawError( - __('Query error') . ':
' . $orig_error - ) + $message = Message::rawError( + __('Query error') . ':
' . $orig_error + ); + $this->response->addHTML( + Generator::getMessage($message, $sql_query, 'error') ); $regenerate = true; } From 7ef1c5f8387e2397db2eb4ee03572f96491af72d Mon Sep 17 00:00:00 2001 From: William Desportes Date: Mon, 26 Jul 2021 18:16:40 +0200 Subject: [PATCH 03/11] =?UTF-8?q?Add=20ChangeLog=20entries=20for=20#17016?= =?UTF-8?q?=20and=C2=A0#17037?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: William Desportes --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 77f8aae289..4f53e6cc01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,6 +58,8 @@ phpMyAdmin - ChangeLog - issue #16842 Fixed missing password modes on PerconaDB - issue #16947 Fix "Change login information" form not working - issue #17004 Fix Advisor for MariaDB >= 10.5 because of removed "innodb_log_files_in_group" variable +- issue #17037 Fix change structure does not surface errors +- issue #17016 Fixed online Transaction, errors not reported on structure edit 5.1.1 (2021-06-04) - issue #13325 Fixed created procedure shows up in triggers and events and vice-versa From f72b61677676ea95f80b2e1670833c57480490f4 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 27 Jul 2021 00:33:30 +0200 Subject: [PATCH 04/11] Ref #17004 - Improve Advisor rule Signed-off-by: William Desportes --- libraries/advisory_rules_generic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/advisory_rules_generic.php b/libraries/advisory_rules_generic.php index a9d6fc0e6d..6a65948e68 100644 --- a/libraries/advisory_rules_generic.php +++ b/libraries/advisory_rules_generic.php @@ -642,7 +642,7 @@ return [ // From MariaDB 10.5, there is 1 redo log. // For MariaDB 10.4 and before, the number of redo log files is configured // by the innodb_log_files_in_group system variable. - 'formula' => '(innodb_log_file_size * 1)/ innodb_buffer_pool_size * 100', + 'formula' => 'innodb_log_file_size / innodb_buffer_pool_size * 100', 'test' => 'value < 20 && innodb_log_file_size / (1024 * 1024) < 256', 'issue' => __( 'The InnoDB log file size is not an appropriate size, in relation to the InnoDB buffer pool.' From 423613bb5b6b8f890d5b3994622d18b9a5424c2a Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 27 Jul 2021 01:35:51 +0200 Subject: [PATCH 05/11] Fix #17042 - SQL escaping bug on DB name with special chars on submit query with rollback option Signed-off-by: William Desportes --- libraries/classes/Import.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/classes/Import.php b/libraries/classes/Import.php index c66f5b06cb..cca97268a2 100644 --- a/libraries/classes/Import.php +++ b/libraries/classes/Import.php @@ -1779,8 +1779,8 @@ class Import // Query to check if table is 'Transactional'. $check_query = 'SELECT `ENGINE` FROM `information_schema`.`tables` ' - . 'WHERE `table_name` = "' . $table . '" ' - . 'AND `table_schema` = "' . $db . '" ' + . 'WHERE `table_name` = "' . $dbi->escapeString($table) . '" ' + . 'AND `table_schema` = "' . $dbi->escapeString($db) . '" ' . 'AND UPPER(`engine`) IN ("' . implode('", "', $transactional_engines) . '")'; From f6e09950a0f759b716310184a9d01ea66ac98eef Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 27 Jul 2021 01:36:52 +0200 Subject: [PATCH 06/11] Add a ChangeLog entry for #17042 Signed-off-by: William Desportes --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 4f53e6cc01..44ebb3cc9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -60,6 +60,7 @@ phpMyAdmin - ChangeLog - issue #17004 Fix Advisor for MariaDB >= 10.5 because of removed "innodb_log_files_in_group" variable - issue #17037 Fix change structure does not surface errors - issue #17016 Fixed online Transaction, errors not reported on structure edit +- issue #17042 Fix SQL escaping bug on DB name with special chars on submit query with rollback option 5.1.1 (2021-06-04) - issue #13325 Fixed created procedure shows up in triggers and events and vice-versa From 6addfdfd96a18e59189b79a8db30c9a33c29c7f6 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 27 Jul 2021 01:56:11 +0200 Subject: [PATCH 07/11] Fix #17027 - Better handle display of sorted binary columns in results summary Signed-off-by: William Desportes --- libraries/classes/Display/Results.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index 096dfcd9a9..8edb9b7c47 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -4361,6 +4361,7 @@ class Results if (stripos($meta->type, self::BLOB_FIELD) !== false || ($meta->type === self::GEOMETRY_FIELD) + || ($meta->type === 'string' && $meta->charsetnr === 63)// Is a binary string ) { $column_for_first_row = $this->handleNonPrintableContents( $meta->type, @@ -4393,6 +4394,7 @@ class Results $meta = $fields_meta[$sorted_column_index]; if (stripos($meta->type, self::BLOB_FIELD) !== false || ($meta->type === self::GEOMETRY_FIELD) + || ($meta->type === 'string' && $meta->charsetnr === 63)// Is a binary string ) { $column_for_last_row = $this->handleNonPrintableContents( $meta->type, From 8f04fb980b2f781c5f946b3f774786212fc0ef6c Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 27 Jul 2021 01:57:03 +0200 Subject: [PATCH 08/11] Add a ChangeLog entry for #17027 Signed-off-by: William Desportes --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 44ebb3cc9e..dc57ef9821 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,6 +61,7 @@ phpMyAdmin - ChangeLog - issue #17037 Fix change structure does not surface errors - issue #17016 Fixed online Transaction, errors not reported on structure edit - issue #17042 Fix SQL escaping bug on DB name with special chars on submit query with rollback option +- issue #17027 Better handle the display of sorted binary columns in results summary 5.1.1 (2021-06-04) - issue #13325 Fixed created procedure shows up in triggers and events and vice-versa From a92a9c2a9d87d9d5bdf087a7e725794e4a3bf867 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 27 Jul 2021 02:35:07 +0200 Subject: [PATCH 09/11] Add a test for #16398 Signed-off-by: William Desportes --- .../Controllers/ImportControllerTest.php | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 test/classes/Controllers/ImportControllerTest.php diff --git a/test/classes/Controllers/ImportControllerTest.php b/test/classes/Controllers/ImportControllerTest.php new file mode 100644 index 0000000000..6bc92b25d6 --- /dev/null +++ b/test/classes/Controllers/ImportControllerTest.php @@ -0,0 +1,63 @@ + 'Saint-Louis - Châteaulin', ':1' => '4']; + $_POST['sql_query'] = 'SELECT A.*' . "\n" + . 'FROM table1 A' . "\n" + . 'WHERE A.nomEtablissement = :nomEta AND foo = :1 AND `:a` IS NULL'; + $sql_query = $_POST['sql_query']; + + $this->dummyDbi->addResult( + 'SELECT A.* FROM table1 A WHERE A.nomEtablissement = Saint-Louis - Châteaulin' + . ' AND foo = 4 AND `:a` IS NULL LIMIT 0, 25', + [] + ); + + $this->dummyDbi->addResult( + 'SHOW CREATE TABLE `pma_test`.`table1`', + [] + ); + + $this->dummyDbi->addResult( + 'SHOW FULL COLUMNS FROM `pma_test`.`table1`', + [] + ); + + /** @var ImportController $importController */ + $importController = $containerBuilder->get(ImportController::class); + $importController->index(); + $this->assertResponseWasSuccessfull(); + + $this->assertAllQueriesConsumed(); + } +} From 10df7c408e69acb2e3af03c65975de8a7297a132 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 27 Jul 2021 02:43:18 +0200 Subject: [PATCH 10/11] Fix #16398 - Quote non numeric values on parameterized queries Signed-off-by: William Desportes --- libraries/classes/Controllers/ImportController.php | 9 +++++++-- test/classes/Controllers/ImportControllerTest.php | 13 ++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/libraries/classes/Controllers/ImportController.php b/libraries/classes/Controllers/ImportController.php index f5c891f81f..41d23afa04 100644 --- a/libraries/classes/Controllers/ImportController.php +++ b/libraries/classes/Controllers/ImportController.php @@ -41,6 +41,7 @@ use function strlen; use function substr; use function time; use function trim; +use function is_numeric; final class ImportController extends AbstractController { @@ -170,17 +171,21 @@ final class ImportController extends AbstractController ) { $parameters = $_POST['parameters']; foreach ($parameters as $parameter => $replacement) { + $replacementValue = $this->dbi->escapeString($replacement); + if (! is_numeric($replacementValue)) { + $replacementValue = '\'' . $replacementValue . '\''; + } $quoted = preg_quote($parameter, '/'); // making sure that :param does not apply values to :param1 $sql_query = preg_replace( '/' . $quoted . '([^a-zA-Z0-9_])/', - $this->dbi->escapeString($replacement) . '${1}', + $replacementValue . '${1}', $sql_query ); // for parameters the appear at the end of the string $sql_query = preg_replace( '/' . $quoted . '$/', - $this->dbi->escapeString($replacement), + $replacementValue, $sql_query ); } diff --git a/test/classes/Controllers/ImportControllerTest.php b/test/classes/Controllers/ImportControllerTest.php index 6bc92b25d6..e357f0862a 100644 --- a/test/classes/Controllers/ImportControllerTest.php +++ b/test/classes/Controllers/ImportControllerTest.php @@ -38,7 +38,7 @@ class ImportControllerTest extends AbstractTestCase $sql_query = $_POST['sql_query']; $this->dummyDbi->addResult( - 'SELECT A.* FROM table1 A WHERE A.nomEtablissement = Saint-Louis - Châteaulin' + 'SELECT A.* FROM table1 A WHERE A.nomEtablissement = \'Saint-Louis - Châteaulin\'' . ' AND foo = 4 AND `:a` IS NULL LIMIT 0, 25', [] ); @@ -58,6 +58,17 @@ class ImportControllerTest extends AbstractTestCase $importController->index(); $this->assertResponseWasSuccessfull(); + $this->assertStringContainsString( + 'MySQL returned an empty result set (i.e. zero rows).', + $this->getResponseHtmlResult() + ); + + $this->assertStringContainsString( + 'SELECT A.*' . "\n" . 'FROM table1 A' . "\n" + . 'WHERE A.nomEtablissement = \'Saint-Louis - Châteaulin\' AND foo = 4 AND `:a` IS NULL', + $this->getResponseHtmlResult() + ); + $this->assertAllQueriesConsumed(); } } From 436e0da1857e558bf61ad6a2485f3abb255b6922 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 27 Jul 2021 02:45:53 +0200 Subject: [PATCH 11/11] Add a ChangeLog entry for #16398 Signed-off-by: William Desportes --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index dc57ef9821..83923a0ed1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,6 +62,7 @@ phpMyAdmin - ChangeLog - issue #17016 Fixed online Transaction, errors not reported on structure edit - issue #17042 Fix SQL escaping bug on DB name with special chars on submit query with rollback option - issue #17027 Better handle the display of sorted binary columns in results summary +- issue #16398 Quote non numeric values on parameterized queries 5.1.1 (2021-06-04) - issue #13325 Fixed created procedure shows up in triggers and events and vice-versa