Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnkush Patil <aspraz2658@gmail.com>2022-07-17 17:30:02 +0300
committerMaurĂ­cio Meneghini Fauth <mauricio@fauth.dev>2022-07-19 21:28:43 +0300
commit987cb5043dba8d385a4890bb171a5bf58bcd10ed (patch)
tree311bfaf16e4dcfff55f01a56e7702e57a9ff53d5 /test
parentf82e460805b2ac1cfdbd3b877c855a8b539a5334 (diff)
fixed find replace regex issue if no matching result set found
When find and replace searching used with regex, at the time of replace empty CASE END condition was causing issue. Fixes #17388 Closes #17641 Signed-off-by: Ankush Patil <aspraz2658@gmail.com> Signed-off-by: MaurĂ­cio Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
-rw-r--r--test/classes/Controllers/Table/FindReplaceControllerTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/classes/Controllers/Table/FindReplaceControllerTest.php b/test/classes/Controllers/Table/FindReplaceControllerTest.php
index 43895e7590..8f9ff0bc47 100644
--- a/test/classes/Controllers/Table/FindReplaceControllerTest.php
+++ b/test/classes/Controllers/Table/FindReplaceControllerTest.php
@@ -92,4 +92,30 @@ class FindReplaceControllerTest extends AbstractTestCase
. "WHERE `Field1` LIKE '%Field%' COLLATE UTF-8_bin";
$this->assertEquals($result, $sql_query);
}
+
+ public function testReplaceWithRegex(): void
+ {
+ $tableSearch = new FindReplaceController(
+ ResponseRenderer::getInstance(),
+ new Template(),
+ $GLOBALS['db'],
+ $GLOBALS['table'],
+ $GLOBALS['dbi']
+ );
+
+ $columnIndex = 0;
+ $find = 'Field';
+ $replaceWith = 'Column';
+ $useRegex = true;
+ $charSet = 'UTF-8';
+
+ $tableSearch->replace($columnIndex, $find, $replaceWith, $useRegex, $charSet);
+
+ $sql_query = $GLOBALS['sql_query'];
+
+ $result = 'UPDATE `table` SET `Field1` = `Field1`'
+ . " WHERE `Field1` RLIKE 'Field' COLLATE UTF-8_bin";
+
+ $this->assertEquals($result, $sql_query);
+ }
}