summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/sqlite_driver.c
diff options
context:
space:
mode:
authorAhmed Abdou <email@ahmed.ro>2019-02-17 22:59:00 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-08-11 17:12:48 +0200
commit2fe2e5b48f8cf9a45ac2530dd0e2dca8f4287e01 (patch)
tree994e5f20b990ce660cb4208b6f3edf48d9fcfb73 /ext/pdo_sqlite/sqlite_driver.c
parent2fa4ca95db262267aa6bd46c5e2f74aa42542fc3 (diff)
downloadphp-git-2fe2e5b48f8cf9a45ac2530dd0e2dca8f4287e01.tar.gz
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.
Diffstat (limited to 'ext/pdo_sqlite/sqlite_driver.c')
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 2cc7f72475..3d85a6db10 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -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;