mirror of
https://github.com/php/php-src.git
synced 2026-03-25 16:52:18 +01:00
PDO driver constructors are throwing PdoException without setting errorInfo, so create a new reusable function that throws exceptions for PDO and will also set the errorInfo. Use this function in pdo_mysql, pdo_sqlite, and pdo_pgsql.
17 lines
415 B
PHP
17 lines
415 B
PHP
--TEST--
|
|
Bug #64705 errorInfo property of PDOException is null when PDO::__construct() fails
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$dsn = 'sqlite:./bug64705NonExistingDir/bug64705NonExistingDb';
|
|
try {
|
|
$pdo = new \PDO($dsn, null, null);
|
|
} catch (\PDOException $e) {
|
|
var_dump(!empty($e->errorInfo) && is_array($e->errorInfo));
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
bool(true)
|