ID:               44791
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at benjaminschulz dot com
-Status:           Open
+Status:           Analyzed
 Bug Type:         PostgreSQL related
 Operating System: osx
 PHP Version:      5.3CVS-2008-04-21 (CVS)
 New Comment:

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.


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

[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

Reply via email to