From 22128e5f89fa9f22defad1b6448ce19f17371f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sun, 14 May 2006 16:40:54 +0000 Subject: [PATCH] Fix reading database list with MySQL wildcards (bug #1487613). --- ChangeLog | 4 ++++ libraries/common.lib.php | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4606d929a..987c7a030 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - ChangeLog $Id$ $Source$ +2006-05-14 Michal Čihař + * libraries/common.lib.php: Fix reading database list with MySQL wildcards + (bug #1487613). + 2006-05-14 Marc Delisle * libraries/import.lib.php: bug #1482841, support USE statement in the import file diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 181994632..8c94fab83 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -3207,14 +3207,14 @@ if (! defined('PMA_MINIMUM_COMMON')) { // We don't want more than one asterisk inside our 'only_db'. continue; } - if ($is_show_dbs && ereg('(^|[^\])(_|%)', $dblist[$i])) { + if ($is_show_dbs && preg_match('/(^|[^\\\\])(_|%)/', $dblist[$i])) { $local_query = 'SHOW DATABASES LIKE \'' . $dblist[$i] . '\''; // here, a PMA_DBI_query() could fail silently // if SHOW DATABASES is disabled - $rs = PMA_DBI_try_query($local_query, $controllink); + $rs = PMA_DBI_try_query($local_query, $userlink); if ($i == 0 && ! $rs) { - $error_code = substr(PMA_DBI_getError($controllink), 1, 4); + $error_code = substr(PMA_DBI_getError($userlink), 1, 4); if ($error_code == 1227 || $error_code == 1045) { // "SHOW DATABASES" statement is disabled or not allowed to user $true_dblist[] = str_replace('\\_', '_', str_replace('\\%', '%', $dblist[$i]));