Bug #67557 [Opn]: PHP PDO insert using transaction doesn't show error

From: Date: Thu, 03 Jul 2014 12:46:01 +0000
Subject: Bug #67557 [Opn]: PHP PDO insert using transaction doesn't show error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186447@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67557&edit=1 ID: 67557 User updated by: marcio at evomaster dot com dot br Reported by: marcio at evomaster dot com dot br Summary: PHP PDO insert using transaction doesn't show error Status: Open Type: Bug Package: PDO PgSQL Operating System: CentOS 6.5 PHP Version: 5.5.14 Block user comment: N Private report: N New Comment: I forgot to say that is very critical the fact of $Pdo->commit() returns true, even with the $Ps->execute() failure. Previous Comments: ------------------------------------------------------------------------ [2014-07-03 03:13:07] marcio at evomaster dot com dot br Description: ------------ --- From manual page: http://www.php.net/pdostatement.execute --- $Pdo = new PDO('pgsql:host=localhost;port=5432;dbname=mydb', 'user', 'password'); $options = = array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY, PDO::ATTR_EMULATE_PREPARES => false ); $sql = 'INSERT INTO my_table ( field_a, field_b ) VALUES ( :field_a, :field_b )'; $Pdo->beginTransaction(); $Ps = $Pdo->prepare($sql, $options); $Ps->execute(array( ':field_a' => 'Field A', ':field_b' => 'Field B', ':field_c' => 'Field C' )); $Pdo->commit(); Test script: --------------- $Ps-execute() returns false, but doesn't show an error message telling that there are more columns than in the SQL specified. In my real case i have more than one SQL statement, because of this i am using a transaction. Expected result: ---------------- I expect that PHP throw an exception or error Actual result: -------------- PHP didn't trigger exception or error and proceed with the code ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67557&edit=1

« previous php.bugs (#186447) next »