Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 58a2efd

Browse files
committed
fixes timeouts in pdo
1 parent 292653c commit 58a2efd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ZendDiagnostics/Check/PDOCheck.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ public function check()
4242
$msg = 'Could not talk to database server';
4343

4444
try {
45-
$pdo = new PDO($this->dsn, $this->username, $this->password);
45+
$options = array(
46+
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
47+
PDO::ATTR_TIMEOUT => $this->timeout
48+
);
4649

47-
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
48-
$pdo->setAttribute(PDO::ATTR_TIMEOUT, $this->timeout);
50+
$pdo = new PDO($this->dsn, $this->username, $this->password, $options);
4951

5052
$status = $pdo->getAttribute(PDO::ATTR_CONNECTION_STATUS);
5153
if (null !== $status) {

0 commit comments

Comments
 (0)