Skip to content

Commit 9dd412d

Browse files
author
Ivan Gavryshko
committed
MAGETWO-43906: Long database prefix length breaks setup
- changes according to CR
1 parent 94097e9 commit 9dd412d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

setup/src/Magento/Setup/Test/Unit/Validator/DbValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function testCheckDatabaseTablePrefixWrongFormat()
8989

9090
/**
9191
* @expectedException \InvalidArgumentException
92-
* @expectedExceptionMessage Table prefix length can't be more then
92+
* @expectedExceptionMessage Table prefix length can't be more than
9393
*/
9494
public function testCheckDatabaseTablePrefixWrongLength()
9595
{

setup/src/Magento/Setup/Validator/DbValidator.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
class DbValidator
1717
{
1818

19+
/**
20+
* Db prefix max length
21+
*/
1922
const DB_PREFIX_LENGTH = 10;
2023

2124
/**
@@ -47,12 +50,15 @@ public function checkDatabaseTablePrefix($prefix)
4750
//The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_);
4851
// the first character should be a letter.
4952
if ($prefix !== '' && !preg_match('/^([a-zA-Z])([[:alnum:]_]+)$/', $prefix)) {
50-
throw new \InvalidArgumentException('Please correct the table prefix format.');
53+
throw new \InvalidArgumentException(
54+
'Please correct the table prefix format, should contain only numbers, letters or underscores.'
55+
.' The first character should be a letter.'
56+
);
5157
}
5258

5359
if (strlen($prefix) > self::DB_PREFIX_LENGTH) {
5460
throw new \InvalidArgumentException(
55-
'Table prefix length can\'t be more then ' . self::DB_PREFIX_LENGTH . ' characters.'
61+
'Table prefix length can\'t be more than ' . self::DB_PREFIX_LENGTH . ' characters.'
5662
);
5763
}
5864

0 commit comments

Comments
 (0)