Skip to content

Commit d17bd4a

Browse files
committed
pdo update
1 parent 9ae8da2 commit d17bd4a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/pdo/pdo_stmt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,14 @@ static bool really_register_bound_param(struct pdo_bound_param_data *param, pdo_
276276
}
277277

278278
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_STR && param->max_value_len <= 0 && !Z_ISNULL_P(parameter)) {
279+
zend_bool is_false = (Z_TYPE_P(parameter) == IS_FALSE);
279280
if (!try_convert_to_string(parameter)) {
280281
return 0;
281282
}
283+
/* the pgsql's driver does not handle empty string for false bound parameters */
284+
if (is_false) {
285+
ZVAL_STR(parameter, ZSTR_CHAR('0'));
286+
}
282287
} else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_INT && (Z_TYPE_P(parameter) == IS_FALSE || Z_TYPE_P(parameter) == IS_TRUE)) {
283288
convert_to_long(parameter);
284289
} else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && Z_TYPE_P(parameter) == IS_LONG) {

0 commit comments

Comments
 (0)