ID: 44791
User updated by: php at benjaminschulz dot com
Reported By: php at benjaminschulz dot com
Status: Analyzed
Bug Type: PostgreSQL related
Operating System: osx
PHP Version: 5.3CVS-2008-04-21 (CVS)
New Comment:
This applies to pg_send_execute, too.
Previous Comments:
------------------------------------------------------------------------
[2008-04-21 09:32:58] [EMAIL PROTECTED]
The problem is due to the way the casting is done internally:
SEPARATE_ZVAL(tmp);
convert_to_string_ex(tmp);
if (Z_TYPE_PP(tmp) != IS_STRING) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting
parameter");
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
}
It could be improved by testing the variable type prior to convert.
However I'm not sure if it is desired or if it has some bad side effects
like BC breaks.
------------------------------------------------------------------------
[2008-04-21 09:14:38] php at benjaminschulz dot com
Description:
------------
Binding a boolean "false" to a statement doesn't work.
Reproduce code:
---------------
$result = pg_prepare($dbconn, "my_query", 'SELECT * FROM test WHERE
boolfield = $1');
$result = pg_execute($dbconn, "my_query", array(true)); // works
$result = pg_execute($dbconn, "my_query", array(false)); // triggers an
error
Expected result:
----------------
No error ;)
Actual result:
--------------
Warning: pg_execute(): Query failed: ERROR: invalid input syntax for
type boolean: "" in ...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44791&edit=1