Skip to content

Commit e412c83

Browse files
committed
Extract host and port or socket from host option
Extract host and port number or socket name from host option for mysql and pgsql drivers
1 parent 5a09dd0 commit e412c83

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/Pdo/PdoDriver.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ public function connect()
209209
break;
210210

211211
case 'mysql':
212-
$this->options['port'] = $this->options['port'] ?? 3306;
212+
// Extract host and port or socket from host option
213+
$this->setHostPortSocket(3306);
213214

214215
if ($this->options['socket'] !== null) {
215216
$format = 'mysql:unix_socket=#SOCKET#;dbname=#DBNAME#;charset=#CHARSET#';
@@ -257,7 +258,8 @@ public function connect()
257258
break;
258259

259260
case 'pgsql':
260-
$this->options['port'] = $this->options['port'] ?? 5432;
261+
// Extract host and port or socket from host option
262+
$this->setHostPortSocket(5432);
261263

262264
if ($this->options['socket'] !== null) {
263265
$format = 'pgsql:host=#SOCKET#;dbname=#DBNAME#';

0 commit comments

Comments
 (0)