Skip to content

Commit 49a494c

Browse files
author
Ivan Gavryshko
committed
MAGETWO-31904: There is no validation for 'Table prefix' on Step 2: Add a Database during instalation
- addded prefix validation
1 parent 2ebd193 commit 49a494c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

setup/src/Magento/Setup/Controller/DatabaseCheck.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ public function __construct(InstallerFactory $installerFactory, WebLogger $webLo
4747
public function indexAction()
4848
{
4949
$params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY);
50+
var_dump($params);
5051
try {
52+
if (isset($params['tablePrefix'])
53+
&& $params['tablePrefix'] !==''
54+
&& !preg_match('/^([[:alnum:]]+)([[:alnum:]_]+)$/', $params['tablePrefix'])
55+
) {
56+
die("dfdfd");
57+
throw new \InvalidArgumentException('Table prefix is in wrong format.');
58+
}
5159
$installer = $this->installerFactory->create($this->webLogger);
5260
$password = isset($params['password']) ? $params['password'] : '';
5361
$installer->checkDatabaseConnection($params['name'], $params['host'], $params['user'], $password);

0 commit comments

Comments
 (0)