From 1df092f4d7b54d7e3d30adf302951b15990d9685 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Mon, 7 Feb 2005 21:55:32 +0000 Subject: [PATCH] bug #1114363, error when SHOW DATABASES is disabled --- ChangeLog | 2 ++ libraries/common.lib.php | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a12c4a1b9..cd3290758 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ $Source$ it expects a result resource * libraries/tbl_move_copy.php: bug #1117112, commands out of sync when using "copy table" operation + * libraries/common.lib.php: bug #1114363, error when SHOW DATABASES is + disabled 2005-02-07 Alexander M. Turek * libraries/mcrypt.lib.php: Bug #1117907 ("wrong parameter count" with diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 63b090ac6..0037ddf4f 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1309,10 +1309,13 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} } if ($is_show_dbs && ereg('(^|[^\])(_|%)', $dblist[$i])) { $local_query = 'SHOW DATABASES LIKE \'' . $dblist[$i] . '\''; - $rs = PMA_DBI_query($local_query, $dbh); - // "SHOW DATABASES" statement is disabled + // here, a PMA_DBI_query() could fail silently + // if SHOW DATABASES is disabled + $rs = PMA_DBI_try_query($local_query, $dbh); + if ($i == 0 && (substr(PMA_DBI_getError($dbh), 1, 4) == 1045)) { + // "SHOW DATABASES" statement is disabled $true_dblist[] = str_replace('\\_', '_', str_replace('\\%', '%', $dblist[$i])); $is_show_dbs = FALSE; }