Skip to content

Commit 3b703f4

Browse files
committed
Suppress E_WARNING from PDO::__construct()
When you provide an invalid hostname to PDO::__contruct it will throw an E_WARNING regardless of the PDO::ERRMODE_EXCEPTION. This fixes that.
1 parent 39612f6 commit 3b703f4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Ifsnop/Mysqldump/Mysqldump.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ private function connect()
186186
try {
187187
switch ($this->dbType) {
188188
case 'sqlite':
189-
$this->dbHandler = new PDO("sqlite:" . $this->db, null, null, $this->pdoSettings);
189+
$this->dbHandler = @new PDO("sqlite:" . $this->db, null, null, $this->pdoSettings);
190190
break;
191191
case 'mysql':
192192
case 'pgsql':
@@ -195,7 +195,7 @@ private function connect()
195195
":host=" . $this->host .
196196
(isset($this->port) ? ";port=" . $this->port : "") .
197197
";dbname=" . $this->db;
198-
$this->dbHandler = new PDO(
198+
$this->dbHandler = @new PDO(
199199
$dsn,
200200
$this->user,
201201
$this->pass,

0 commit comments

Comments
 (0)