Skip to content

Commit 303d46f

Browse files
committed
PdoDriver: check for misconfigured PDO connections resource
1 parent 73790f4 commit 303d46f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Dibi/Drivers/PdoDriver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ public function __construct(array &$config)
7171

7272
$this->driverName = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
7373
$this->serverVersion = (string) ($config['version'] ?? @$this->connection->getAttribute(PDO::ATTR_SERVER_VERSION)); // @ - may be not supported
74+
75+
if (!\in_array($this->connection->getAttribute(\PDO::ATTR_ERRMODE), [null, \PDO::ERRMODE_WARNING], true)) {
76+
throw new Dibi\DriverException('PDO connection in other error mode then WARNING (default) is currently not supported. Consider upgrading to Dibi >=4.1.0.');
77+
}
7478
}
7579

7680

0 commit comments

Comments
 (0)