ID:               44597
 Updated by:       sjo...@php.net
-Summary:          Postgres driver does not prepare booleans correctly
 Reported By:      kenaniah at gmail dot com
 Status:           Open
 Bug Type:         PDO related
 Operating System: Red Hat 4.1.1
 PHP Version:      5.2.6
 New Comment:

Currently, every variable is assumed to be PDO_PARAM_STR. This patch
changes this to PDO_PARAM_INT or PDO_PARAM_BOOL if the passed variable
is a long or a bool, respectively.

http://www.gissen.nl/files/bug44597.patch

This may break existing scripts, which depend on false being converted
to an empty string.


Previous Comments:
------------------------------------------------------------------------

[2009-09-21 19:48:55] kenaniah at gmail dot com

In response to sjoerd, this may very well be a product of bad
documentation, but that does not exclude the functional use case. One
could reasonably claim that proper detection of parameter types should
in fact be part of the functional definition of execute(). Virtually
every database interface built on top of PDO works around this boolean
"bug" and allows support for mixed content in the parameter array to a
prepared statement.

IMHO, the PDO core should therefore be no different. Whether classified
as a bug or a feature, I believe that this should still be addressed.

------------------------------------------------------------------------

[2009-09-21 19:18:21] sjo...@php.net

I think this is not a bug but a limitation of execute(): it assumes the
values in the array are string. If you want it interpreted differently,
you should call bindParam() with a data_type parameter.

I filed Bug #49614 "PDOStatement::execute assumes string values in
array" to clarify the documentation.

------------------------------------------------------------------------

[2009-09-13 20:55:01] kenaniah at gmail dot com

This is still reproducible on 5.3.0 paired with PG 8.x

------------------------------------------------------------------------

[2009-09-13 19:08:46] ant at specialops dot ath dot cx

I can still reproduce this on PHP 5.3.0 and PostgreSQL 8.4.1.

------------------------------------------------------------------------

[2009-06-14 11:53:21] execut3 at gmail dot com

The issue is still not fixed, I'm with PHP 5.2.6 on Ubuntu and 
postgresql 8.3.

ERROR: invalid input syntax for type boolean: ""

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/44597

-- 
Edit this bug report at http://bugs.php.net/?id=44597&edit=1

Reply via email to