bug #1807816 [search] regular expression search does not work with backslashes

This commit is contained in:
Marc Delisle
2007-12-04 18:07:16 +00:00
parent 849bffdfeb
commit 3258795c5b
2 changed files with 16 additions and 9 deletions

View File

@@ -7,6 +7,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
2.11.4.0 (not yet released)
- bug #1843428 [GUI] Space issue with DROP/DELETE/ALTER TABLE
- bug #1807816 [search] regular expression search doesn't work with
backslashes
2.11.3.0 (not yet released)
- patch #1818389 to remove a notice (failed to flush buffer), thanks to

View File

@@ -82,14 +82,6 @@ $search_options = array(
'4' => $GLOBALS['strSearchOption4'],
);
if (empty($_REQUEST['search_str']) || ! is_string($_REQUEST['search_str'])) {
unset($_REQUEST['submit_search']);
$searched = '';
} else {
$searched = htmlspecialchars($_REQUEST['search_str']);
$search_str = PMA_sqlAddslashes($_REQUEST['search_str'], true);
}
if (empty($_REQUEST['search_option']) || ! is_string($_REQUEST['search_option'])
|| ! array_key_exists($_REQUEST['search_option'], $search_options)) {
$search_option = 1;
@@ -99,6 +91,20 @@ if (empty($_REQUEST['search_option']) || ! is_string($_REQUEST['search_option'])
$option_str = $search_options[$_REQUEST['search_option']];
}
if (empty($_REQUEST['search_str']) || ! is_string($_REQUEST['search_str'])) {
unset($_REQUEST['submit_search']);
$searched = '';
} else {
$searched = htmlspecialchars($_REQUEST['search_str']);
// For "as regular expression" (search option 4), we should not treat
// this as an expression that contains a LIKE (second parameter of
// PMA_sqlAddslashes()).
//
// Usage example: If user is seaching for a literal $ in a regexp search,
// he should enter \$ as the value.
$search_str = PMA_sqlAddslashes($_REQUEST['search_str'], ($search_option == 4 ? false : true));
}
$tables_selected = array();
if (empty($_REQUEST['table_select']) || ! is_array($_REQUEST['table_select'])) {
unset($_REQUEST['submit_search']);
@@ -219,7 +225,6 @@ if (isset($_REQUEST['submit_search'])) {
// VIEWs, anyway we have a WHERE clause that should limit results
$sql['select_count'] = $sqlstr_select . ' COUNT(*) AS `count`' . $sqlstr_from . $sqlstr_where;
$sql['delete'] = $sqlstr_delete . $sqlstr_from . $sqlstr_where;
return $sql;
} // end of the "PMA_getSearchSqls()" function