|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-04-21 09:14 UTC] 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 ... PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 11 19:00:02 2025 UTC |
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.