From ac7a6cee32997b2f5d505a3a6f210543564ffd9f Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Mon, 25 Aug 2014 12:41:51 -0400 Subject: [PATCH] bug #4522 Duplicate column names while assigning index Signed-off-by: Marc Delisle --- ChangeLog | 1 + libraries/Table.class.php | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cde65ff6ed..c796c30142 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ phpMyAdmin - ChangeLog - bug #4520 sql.js: cannot read property - bug #4521 Initially allowed chart types do not match selected data - bug #4518 Export to SQL: CREATE TABLE option AUTO_INCREMENT ignored +- bug #4522 Duplicate column names while assigning index 4.2.7.1 (2014-08-17) - bug #4501 [security] XSS in table browse page diff --git a/libraries/Table.class.php b/libraries/Table.class.php index 676127c913..7f8d367dc1 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -1439,8 +1439,20 @@ class PMA_Table if (count($index) > 1) { continue; } - $return[] = ($fullName ? $this->getFullName($backquoted) . '.' : '') - . ($backquoted ? PMA_Util::backquote($index[0]) : $index[0]); + if ($fullName) { + $possible_column = $this->getFullName($backquoted) . '.'; + } else { + $possible_column = ''; + } + if ($backquoted) { + $possible_column .= PMA_Util::backquote($index[0]); + } else { + $possible_column .= $index[0]; + } + // a column might have a primary and an unique index on it + if (! in_array($possible_column, $return)) { + $return[] = $possible_column; + } } return $return;