Bug #70313 [Com]: PDO statement fails to throw exception.

From: Date: Thu, 20 Aug 2015 16:13:43 +0000
Subject: Bug #70313 [Com]: PDO statement fails to throw exception.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195376@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70313&edit=1 ID: 70313 Comment by: nsadjadi at gmail dot com Reported by: spectral2k at hotmail dot com Summary: PDO statement fails to throw exception. Status: Open Type: Bug Package: PDO related Operating System: Ubuntu PHP Version: 5.5.28 Block user comment: N Private report: N New Comment: I tested it on MySQL and it gives exception as expected so must probably this is not bug of pdo but bug of PostgreSQL. Previous Comments: ------------------------------------------------------------------------ [2015-08-20 15:17:33] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70313&edit=1

« previous php.bugs (#195376) next »