Merge remote-tracking branch 'origin/pull/12678' into QA_4_6
This commit is contained in:
commit
38a804edde
@ -1259,22 +1259,28 @@ class Table
|
||||
// trailing spaces not allowed even in backquotes
|
||||
return false;
|
||||
}
|
||||
if (! $is_backquoted && $table_name !== trim($table_name)) {
|
||||
// spaces at the start or in between
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! mb_strlen($table_name)) {
|
||||
// zero length
|
||||
return false;
|
||||
}
|
||||
|
||||
if (preg_match('/[.\/\\\\]+/i', $table_name)) {
|
||||
// illegal char . / \
|
||||
if (! $is_backquoted && $table_name !== trim($table_name)) {
|
||||
// spaces at the start or in between only allowed inside backquotes
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
if (! $is_backquoted && preg_match('/^[a-zA-Z0-9_$]+$/', $table_name)) {
|
||||
// only allow the above regex in unquoted identifiers
|
||||
// see : http://dev.mysql.com/doc/refman/5.7/en/identifiers.html
|
||||
return true;
|
||||
} else if ($is_backquoted) {
|
||||
// If backquoted, all characters should be allowed (except w/ trailing spaces)
|
||||
return true;
|
||||
}
|
||||
|
||||
// If not backquoted and doesn't follow the above regex
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -405,10 +405,12 @@ class TableTest extends PMATestCase
|
||||
array('te/st', false),
|
||||
array('te.st', false),
|
||||
array('te\\st', false),
|
||||
array('te st', true),
|
||||
array('te st', false),
|
||||
array(' te st', true, true),
|
||||
array('test ', false),
|
||||
array('te.st', false),
|
||||
array('test ', false, true),
|
||||
array('te.st ', false, true),
|
||||
);
|
||||
}
|
||||
|
||||
@ -777,10 +779,16 @@ class TableTest extends PMATestCase
|
||||
$table_new = 'PMA_.BookMark';
|
||||
$result = $table->rename($table_new);
|
||||
$this->assertEquals(
|
||||
false,
|
||||
true,
|
||||
$result
|
||||
);
|
||||
|
||||
//message
|
||||
$this->assertEquals(
|
||||
"Table PMA_BookMark has been renamed to PMA_.BookMark.",
|
||||
$table->getLastMessage()
|
||||
);
|
||||
|
||||
$table_new = 'PMA_BookMark_new';
|
||||
$db_new = 'PMA_new';
|
||||
$result = $table->rename($table_new, $db_new);
|
||||
@ -790,7 +798,7 @@ class TableTest extends PMATestCase
|
||||
);
|
||||
//message
|
||||
$this->assertEquals(
|
||||
"Table PMA_BookMark has been renamed to PMA_BookMark_new.",
|
||||
"Table PMA_.BookMark has been renamed to PMA_BookMark_new.",
|
||||
$table->getLastMessage()
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user