Skip to content

Commit 5104989

Browse files
committed
Slightly edited tests and fix for bug #62024
1 parent df6ca45 commit 5104989

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ext/pdo_firebird/firebird_statement.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,12 +535,14 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat
535535
int force_null;
536536

537537
case IS_LONG:
538-
var->sqltype = (sizeof(long) == 8 ? SQL_INT64 : SQL_LONG) + (var->sqltype & 1);
538+
/* keep the allow-NULL flag */
539+
var->sqltype = (sizeof(long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1);
539540
var->sqldata = (void*)&Z_LVAL_P(param->parameter);
540541
var->sqllen = sizeof(long);
541542
break;
542543
case IS_DOUBLE:
543-
var->sqltype = SQL_DOUBLE + (var->sqltype & 1);
544+
/* keep the allow-NULL flag */
545+
var->sqltype = SQL_DOUBLE | (var->sqltype & 1);
544546
var->sqldata = (void*)&Z_DVAL_P(param->parameter);
545547
var->sqllen = sizeof(double);
546548
break;
@@ -560,7 +562,8 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat
560562
force_null = (Z_STRLEN_P(param->parameter) == 0);
561563
}
562564
if (!force_null) {
563-
var->sqltype = SQL_TEXT + (var->sqltype & 1);
565+
/* keep the allow-NULL flag */
566+
var->sqltype = SQL_TEXT | (var->sqltype & 1);
564567
var->sqldata = Z_STRVAL_P(param->parameter);
565568
var->sqllen = Z_STRLEN_P(param->parameter);
566569
break;

ext/pdo_firebird/tests/bug_62024.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ $dbh->commit();
2121
$sql = "insert into test_insert (id, text) values (?, ?)";
2222
$sttmt = $dbh->prepare($sql);
2323

24-
$args_ok = [1, "test1"];
25-
$args_err = [2, null];
24+
$args_ok = array(1, "test1");
25+
$args_err = array(2, null);
2626

2727
$res = $sttmt->execute($args_ok);
2828
var_dump($res);

0 commit comments

Comments
 (0)