diff --git a/core/Db/Adapter/Pdo/Mysql.php b/core/Db/Adapter/Pdo/Mysql.php index aaf93e1b6b8a649e039ad2a580a2f6a2804fb740..9e26fb7a2bb0d11ec5fc4b03e8d8989092de1d92 100644 --- a/core/Db/Adapter/Pdo/Mysql.php +++ b/core/Db/Adapter/Pdo/Mysql.php @@ -246,4 +246,19 @@ class Mysql extends Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface $this->cachePreparedStatement[$sql] = $stmt; return $stmt; } + + /** + * Override _dsn() to ensure host and port to not be passed along + * if unix_socket is set since setting both causes unexpected behaviour + * @see http://php.net/manual/en/ref.pdo-mysql.connection.php + */ + protected function _dsn() + { + if (!empty($this->_config['unix_socket'])) { + unset($this->_config['host']); + unset($this->_config['port']); + } + + return parent::_dsn(); + } }