mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
This commit is contained in:
commit
981af26d7b
9 changed files with 86 additions and 6 deletions
|
@ -76,8 +76,7 @@ int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int li
|
|||
}
|
||||
|
||||
if (!dbh->methods) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode, "SQLSTATE[%s] [%d] %s",
|
||||
*pdo_err, einfo->errcode, einfo->errmsg);
|
||||
pdo_throw_exception(einfo->errcode, einfo->errmsg, pdo_err);
|
||||
}
|
||||
|
||||
return einfo->errcode;
|
||||
|
|
17
ext/pdo_sqlite/tests/bug_64705.phpt
Normal file
17
ext/pdo_sqlite/tests/bug_64705.phpt
Normal file
|
@ -0,0 +1,17 @@
|
|||
--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)
|
Loading…
Add table
Add a link
Reference in a new issue