Skip to content

Commit

Permalink
PdoDriver: check for misconfigured PDO connections resource
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuchar committed Jun 11, 2018
1 parent 73790f4 commit 303d46f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Dibi/Drivers/PdoDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public function __construct(array &$config)

$this->driverName = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
$this->serverVersion = (string) ($config['version'] ?? @$this->connection->getAttribute(PDO::ATTR_SERVER_VERSION)); // @ - may be not supported

if (!\in_array($this->connection->getAttribute(\PDO::ATTR_ERRMODE), [null, \PDO::ERRMODE_WARNING], true)) {
throw new Dibi\DriverException('PDO connection in other error mode then WARNING (default) is currently not supported. Consider upgrading to Dibi >=4.1.0.');
}
}


Expand Down

0 comments on commit 303d46f

Please sign in to comment.