Skip to content

Commit 22630de

Browse files
authored
ENGCOM-5445: Fix Adapter\Pdo\Mysql::closeConnection on non-default ports #23428
2 parents ce74d2a + ad6dfc9 commit 22630de

File tree

1 file changed

+15
-8
lines changed
  • lib/internal/Magento/Framework/DB/Adapter/Pdo

1 file changed

+15
-8
lines changed

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -571,14 +571,6 @@ protected function _query($sql, $bind = [])
571571
$triesCount++;
572572
$this->closeConnection();
573573

574-
/**
575-
* _connect() function does not allow port parameter, so put the port back with the host
576-
*/
577-
if (!empty($this->_config['port'])) {
578-
$this->_config['host'] = implode(':', [$this->_config['host'], $this->_config['port']]);
579-
unset($this->_config['port']);
580-
}
581-
582574
$this->_connect();
583575
}
584576

@@ -4034,4 +4026,19 @@ public function getSchemaListener()
40344026
}
40354027
return $this->schemaListener;
40364028
}
4029+
4030+
/**
4031+
* Closes the connection.
4032+
*/
4033+
public function closeConnection()
4034+
{
4035+
/**
4036+
* _connect() function does not allow port parameter, so put the port back with the host
4037+
*/
4038+
if (!empty($this->_config['port'])) {
4039+
$this->_config['host'] = implode(':', [$this->_config['host'], $this->_config['port']]);
4040+
unset($this->_config['port']);
4041+
}
4042+
parent::closeConnection();
4043+
}
40374044
}

0 commit comments

Comments
 (0)