diff --git a/ChangeLog b/ChangeLog index c91279eb6e..554e407928 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,6 +44,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 f53028ac0d..c057c8256f 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -1418,8 +1418,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;