Merge branch 'SachinBahukhandi-search-key-fix' into QA_5_2

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2023-08-28 16:35:13 -03:00
commit e9edcbf67f
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
3 changed files with 24 additions and 3 deletions

View File

@ -58,6 +58,7 @@ phpMyAdmin - ChangeLog
- issue #18578 Fixed PDF export NULL values gives a type error
- issue #18650 Fixed double escaping on foreign key relation link title
- issue #18533 Fixed wrong count for simulated queries
- issue #18611 Fixed an error when searching a table without conditions
5.2.1 (2023-02-07)
- issue #17522 Fix case where the routes cache file is invalid

View File

@ -90,9 +90,12 @@ final class Search
// If there are no search criteria set or no unary criteria operators,
// return
if (
! isset($_POST['criteriaValues'])
&& ! isset($_POST['criteriaColumnOperators'])
&& ! isset($_POST['geom_func'])
! isset($_POST['criteriaColumnOperators'])
|| (
! isset($_POST['criteriaValues'])
&& ! isset($_POST['criteriaColumnOperators'])
&& ! isset($_POST['geom_func'])
)
) {
return '';
}

View File

@ -238,4 +238,21 @@ class SearchTest extends AbstractTestCase
$this->search->buildSqlQuery()
);
}
public function testBuildSqlQueryWithoutConditions(): void
{
$_POST['db'] = 'opengis';
$_POST['table'] = 'world_cities';
$_POST['back'] = 'index.php?route=/table/search';
$_POST['geom_func'] = [2 => ' '];
$_POST['customWhereClause'] = '';
$_POST['session_max_rows'] = '25';
$_POST['orderByColumn'] = '--nil--';
$_POST['order'] = 'ASC';
$_POST['submit'] = 'Go';
$_POST['ajax_request'] = 'true';
$_POST['displayAllColumns'] = 'true';
$this->assertSame('SELECT * FROM `world_cities`', $this->search->buildSqlQuery());
}
}