summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/interbase/interbase.c10
-rw-r--r--ext/interbase/tests/003.phpt9
2 files changed, 13 insertions, 6 deletions
diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c
index 77ba2792f3..daf5bc4444 100644
--- a/ext/interbase/interbase.c
+++ b/ext/interbase/interbase.c
@@ -754,7 +754,7 @@ PHP_MINFO_FUNCTION(ibase)
#ifdef __GNUC__
void (*info_func)(char*) = dlsym(RTLD_DEFAULT, "isc_get_client_version");
#else
- void (__stdcall *info_func)(char*) = NULL;
+ void (__stdcall *info_func)(char*);
HMODULE l = GetModuleHandle("fbclient");
@@ -1615,8 +1615,8 @@ static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size,
}
/* }}} */
-static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf,
- ibase_query *ib_query TSRMLS_DC) /* {{{ */
+static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf, /* {{{ */
+ ibase_query *ib_query TSRMLS_DC)
{
int i, rv = SUCCESS;
XSQLVAR *var = sqlda->sqlvar;
@@ -1628,6 +1628,10 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval **b_vars, BIND_BUF *buf,
var->sqlind = &buf[i].sqlind;
if (Z_TYPE_P(b_var) == IS_NULL) {
+ if ((var->sqltype & 1) != 1) {
+ _php_ibase_module_error("Parameter %d must have a value" TSRMLS_CC, i+1);
+ rv = FAILURE;
+ }
buf[i].sqlind = -1;
} else {
buf[i].sqlind = 0;
diff --git a/ext/interbase/tests/003.phpt b/ext/interbase/tests/003.phpt
index 2d105b1866..d3e60461e5 100644
--- a/ext/interbase/tests/003.phpt
+++ b/ext/interbase/tests/003.phpt
@@ -12,7 +12,7 @@ InterBase: misc sql types (may take a while)
ibase_query(
"create table test3 (
- iter integer,
+ iter integer not null,
v_char char(1000),
v_date timestamp,
v_decimal4_2 decimal(4,2),
@@ -29,6 +29,9 @@ InterBase: misc sql types (may take a while)
)");
ibase_commit();
+ /* should fail, but gracefully */
+ @ibase_query("insert into test3 (iter) values (?)", null);
+
/* if timefmt is not supported, suppress error here */
@ibase_timefmt("%m/%d/%Y %H:%M:%S");
@@ -41,7 +44,7 @@ InterBase: misc sql types (may take a while)
$v_decimal7_2 = rand_number(7,2);
$v_decimal7_0 = rand_number(7,0);
$v_numeric15_15 = rand_number(15,15);
- $v_numeric15_0 = rand_number(15,0);
+ $v_numeric15_0 = $iter ? rand_number(15,0) : 0;
$v_double = rand_number(18);
$v_float = rand_number(7);
$v_integer = rand_number(9,0);
@@ -88,7 +91,7 @@ InterBase: misc sql types (may take a while)
echo " in: $v_numeric15_15\n";
echo " out: $row->V_NUMERIC15_15\n";
}
- if($row->V_NUMERIC15_0 != $v_numeric15_0){
+ if($row->V_NUMERIC15_0 != (string)$v_numeric15_0){
echo " NUMERIC15_0 fail\n";
echo " in: $v_numeric15_0\n";
echo " out: $row->V_NUMERIC15_0\n";