diff --git a/ChangeLog b/ChangeLog index ae2e75727d..d9e96d8024 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,6 +46,7 @@ phpMyAdmin - ChangeLog - 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 +- bug #4487 Export of partitioned table does not import 4.2.7.1 (2014-08-17) - bug #4501 [security] XSS in table browse page diff --git a/libraries/plugins/export/ExportSql.class.php b/libraries/plugins/export/ExportSql.class.php index 889d084d4f..04a2b73670 100644 --- a/libraries/plugins/export/ExportSql.class.php +++ b/libraries/plugins/export/ExportSql.class.php @@ -1555,13 +1555,18 @@ class ExportSql extends ExportPlugin // that could be there starting with MySQL 5.0.24 // in Drizzle it's useless as it contains the value given at table // creation time - $schema_create = preg_replace( - '/AUTO_INCREMENT\s*=\s*([0-9])+/', - '', - $schema_create - ); - - $schema_create .= ($compat != 'MSSQL') ? $auto_increment : ''; + if (preg_match('/AUTO_INCREMENT\s*=\s*([0-9])+/', $schema_create)) { + if ($compat == 'MSSQL' || $auto_increment == '') { + $auto_increment = ' '; + } + $schema_create = preg_replace( + '/\sAUTO_INCREMENT\s*=\s*([0-9])+\s/', + $auto_increment, + $schema_create + ); + } else { + $schema_create .= ($compat != 'MSSQL') ? $auto_increment : ''; + } $GLOBALS['dbi']->freeResult($result); return $warning . $schema_create . ($add_semicolon ? ';' . $crlf : '');