Bug #70313 [Asn->Csd]: PDO statement fails to throw exception.

From: Date: Sun, 10 Jul 2016 12:40:32 +0000
Subject: Bug #70313 [Asn->Csd]: PDO statement fails to throw exception.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202172@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
 Updated by:         mbeccati@php.net
 Reported by:        spectral2k at hotmail dot com
 Summary:            PDO statement fails to throw exception.
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            PDO PgSQL
 Operating System:   Ubuntu
 PHP Version:        5.5.28
 Assigned To:        mbeccati
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of mbeccati
Revision: http://git.php.net/?p=php-src.git;a=commit;h=219ebcb68984a0af524336b165a849781ee65758
Log: Fixed bug #70313 PDO statement fails to throw exception


Previous Comments:
------------------------------------------------------------------------
[2015-08-20 16:13:42] nsadjadi at gmail dot com

I tested it on MySQL and it gives exception as expected so must probably this is not bug of pdo but
bug of PostgreSQL.

------------------------------------------------------------------------
[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


Thread (3 messages)

« previous php.bugs (#202172) next »