PDO statement fails to throw exception.
| Bug #70313 | PDO statement fails to throw exception. | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2015-08-20 15:17 UTC | Modified: | 2016-07-10 10:55 UTC |
|
||||||
| From: | spectral2k at hotmail dot com | Assigned: | mbeccati (profile) | |||||||
| Status: | Closed | Package: | PDO PgSQL | |||||||
| PHP Version: | 5.5.28 | OS: | Ubuntu | |||||||
| Private report: | No | CVE-ID: | None | |||||||
[2015-08-20 15:17 UTC] spectral2k at hotmail dot com
Description:
------------
PDO fails to return SQL errors from PostgreSQL when using an invalid SQL statement and integer based bindParam calls.
If you remove the bindParam calls the execute call will throw an exception.
Test script:
---------------
<?php
$dbh = new PDO('###', '###', '###');
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $dbh->prepare(");");
$a = 'a';
$b = 'b';
$stmt->bindParam(1,$a);
$stmt->bindParam(2,$b);
$stmt->execute();
Expected result:
----------------
An exception should always be thrown when invalid SQL is executed.
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2015-08-20 16:13 UTC] nsadjadi at gmail dot com
[2016-07-10 10:55 UTC] mbeccati@php.net
-Package: PDO related +Package: PDO PgSQL -Assigned To: +Assigned To: mbeccati