#33876 [Opn->Bgs]: PDO misquotes/miscasts bool(false)
ID: 33876
Updated by: iliaa@php.net
Reported By: php at sagi dot org
-Status: Open
+Status: Bogus
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2005-07-27 (dev)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is expected behaviour, when cast to a string bool false is
converted to "" while bool true converted to "1".
Previous Comments:
------------------------------------------------------------------------
[2005-07-27 00:14:50] php at sagi dot org
Description:
------------
Running latest php5 snapshot (php5-200507261230), PDO connected to
pgsql 8.0 server.
I'm trying to run a query similar to this:
$res = $db->prepare('SELECT id FROM table WHERE mybool = ?');
$res->execute(array(false));
PDO throws this exception: 'SQLSTATE[22P02]: Invalid text
representation: 7 ERROR: invalid input syntax for type boolean: ""'
The query that has been executed, according to the server log, is:
"SELECT id FROM table WHERE mybool = ''"
Which is obviously not right. When trying to run the same query with
bool(true) parameter, PDO correctly quotes it as '1'.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33876&edit=1
Thread (10 messages)