abies Sun Feb 15 13:34:48 2004 EDT
Modified files:
/php-src/ext/interbase interbase.c
/php-src/ext/interbase/tests 003.phpt
Log:
Reintroduce param NULL testing (see bug #26777)
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.200&r2=1.201&ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.200 php-src/ext/interbase/interbase.c:1.201
--- php-src/ext/interbase/interbase.c:1.200 Wed Feb 11 07:08:44 2004
+++ php-src/ext/interbase/interbase.c Sun Feb 15 13:34:46 2004
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interbase.c,v 1.200 2004/02/11 12:08:44 abies Exp $ */
+/* $Id: interbase.c,v 1.201 2004/02/15 18:34:46 abies Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -30,7 +30,7 @@
#include "php.h"
-#define FILE_REVISION "$Revision: 1.200 $"
+#define FILE_REVISION "$Revision: 1.201 $"
#if HAVE_IBASE
@@ -754,7 +754,7 @@
#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(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 @@
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;
http://cvs.php.net/diff.php/php-src/ext/interbase/tests/003.phpt?r1=1.5&r2=1.6&ty=u
Index: php-src/ext/interbase/tests/003.phpt
diff -u php-src/ext/interbase/tests/003.phpt:1.5
php-src/ext/interbase/tests/003.phpt:1.6
--- php-src/ext/interbase/tests/003.phpt:1.5 Fri Sep 5 13:02:02 2003
+++ php-src/ext/interbase/tests/003.phpt Sun Feb 15 13:34:47 2004
@@ -5,14 +5,14 @@
--POST--
--GET--
--FILE--
-<?php /* $Id: 003.phpt,v 1.5 2003/09/05 17:02:02 abies Exp $ */
+<?php /* $Id: 003.phpt,v 1.6 2004/02/15 18:34:47 abies Exp $ */
require("interbase.inc");
ibase_connect($test_base);
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 @@
)");
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 @@
$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 @@
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";
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php