georg Mon Dec 20 11:39:15 2004 EDT
Modified files:
/php-src/ext/mysqli mysqli_api.c
Log:
prevent type conversion during mysql_stmt_execute for NULL variables
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.94&r2=1.95&ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.94
php-src/ext/mysqli/mysqli_api.c:1.95
--- php-src/ext/mysqli/mysqli_api.c:1.94 Mon Nov 1 02:19:23 2004
+++ php-src/ext/mysqli/mysqli_api.c Mon Dec 20 11:39:14 2004
@@ -15,7 +15,7 @@
| Author: Georg Richter <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
- $Id: mysqli_api.c,v 1.94 2004/11/01 07:19:23 georg Exp $
+ $Id: mysqli_api.c,v 1.95 2004/12/20 16:39:14 georg Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -539,24 +539,24 @@
for (i = 0; i < stmt->param.var_cnt; i++) {
if (stmt->param.vars[i]) {
- stmt->param.is_null[i] = (stmt->param.vars[i]->type ==
IS_NULL);
-
- switch (stmt->stmt->params[i].buffer_type) {
- case MYSQL_TYPE_VAR_STRING:
-
convert_to_string_ex(&stmt->param.vars[i]);
- stmt->stmt->params[i].buffer =
Z_STRVAL_PP(&stmt->param.vars[i]);
- stmt->stmt->params[i].buffer_length =
strlen(Z_STRVAL_PP(&stmt->param.vars[i]));
- break;
- case MYSQL_TYPE_DOUBLE:
-
convert_to_double_ex(&stmt->param.vars[i]);
- stmt->stmt->params[i].buffer =
(gptr)&Z_LVAL_PP(&stmt->param.vars[i]);
- break;
- case MYSQL_TYPE_LONG:
-
convert_to_long_ex(&stmt->param.vars[i]);
- stmt->stmt->params[i].buffer =
(gptr)&Z_LVAL_PP(&stmt->param.vars[i]);
- break;
- default:
- break;
+ if ( !(stmt->param.is_null[i] =
(stmt->param.vars[i]->type == IS_NULL)) ) {
+ switch (stmt->stmt->params[i].buffer_type) {
+ case MYSQL_TYPE_VAR_STRING:
+
convert_to_string_ex(&stmt->param.vars[i]);
+ stmt->stmt->params[i].buffer =
Z_STRVAL_PP(&stmt->param.vars[i]);
+
stmt->stmt->params[i].buffer_length = strlen(Z_STRVAL_PP(&stmt->param.vars[i]));
+ break;
+ case MYSQL_TYPE_DOUBLE:
+
convert_to_double_ex(&stmt->param.vars[i]);
+ stmt->stmt->params[i].buffer =
(gptr)&Z_LVAL_PP(&stmt->param.vars[i]);
+ break;
+ case MYSQL_TYPE_LONG:
+
convert_to_long_ex(&stmt->param.vars[i]);
+ stmt->stmt->params[i].buffer =
(gptr)&Z_LVAL_PP(&stmt->param.vars[i]);
+ break;
+ default:
+ break;
+ }
}
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php