Bug #67557 [NEW]: PHP PDO insert using transaction doesn't show error
| From: | marcio at evomaster dot com dot br | Date: | Thu, 03 Jul 2014 03:13:08 +0000 |
| Subject: | Bug #67557 [NEW]: PHP PDO insert using transaction doesn't show error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-186437@lists.php.net to get a copy of this message | ||
From: marcio at evomaster dot com dot br
Operating system: CentOS 6.5
PHP version: 5.5.14
Package: PDO PgSQL
Bug Type: Bug
Bug description:PHP PDO insert using transaction doesn't show error
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 bug report at https://bugs.php.net/bug.php?id=67557&edit=1
--