1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Files
archived-php-src/ext/pdo_sqlite/tests/bug_64705.phpt
Ahmed Abdou 2fe2e5b48f Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
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.
2020-08-11 17:12:48 +02:00

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)