From dddcddbf38729f3362b2562671b510107df72b9b Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 26 Nov 2011 06:17:08 -0500 Subject: [PATCH] bug #3442004 [interface] DB suggestion not correct for user with underscore --- ChangeLog | 1 + libraries/check_user_privileges.lib.php | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5133a9b97..343d6dae4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ phpMyAdmin - ChangeLog 3.4.9.0 (not yet released) - bug #3442028 [edit] Inline editing enum fields with null shows no dropdown +- bug #3442004 [interface] DB suggestion not correct for user with underscore 3.4.8.0 (not yet released) - bug #3425230 [interface] enum data split at space char (more space to edit) diff --git a/libraries/check_user_privileges.lib.php b/libraries/check_user_privileges.lib.php index 6dbc251e4..291213cb4 100644 --- a/libraries/check_user_privileges.lib.php +++ b/libraries/check_user_privileges.lib.php @@ -128,8 +128,11 @@ function PMA_analyseShowGrant() && substr(PMA_DBI_getError(), 1, 4) != 1044) ) { if ($GLOBALS['cfg']['SuggestDBName']) { - $GLOBALS['db_to_create'] = preg_replace('/' . $re0 . '_/', '\\1?', $show_grants_dbname); - $GLOBALS['db_to_create'] = preg_replace('/' . $re0 . '%/', '\\1...', $GLOBALS['db_to_create']); + /** + * Do not handle the underscore wildcard + * (this case must be rare anyway) + */ + $GLOBALS['db_to_create'] = preg_replace('/' . $re0 . '%/', '\\1...', $show_grants_dbname); $GLOBALS['db_to_create'] = preg_replace('/' . $re1 . '(%|_)/', '\\1\\3', $GLOBALS['db_to_create']); } $GLOBALS['is_create_db_priv'] = true;