summaryrefslogtreecommitdiff
path: root/ext/mysqli
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2007-10-29 09:51:08 +0000
committerJani Taskinen <jani@php.net>2007-10-29 09:51:08 +0000
commitecb0fb3f0e556a00c7fc49426f6debf96bc7087a (patch)
treea6866cf342f860dfe895862bacaa381ee71db830 /ext/mysqli
parentae6626e78328a8d3f25e1f70008b5627072016a9 (diff)
downloadphp-git-ecb0fb3f0e556a00c7fc49426f6debf96bc7087a.tar.gz
MFH:- Fixed invalid handling of float value passed to an integer field on 64bit machine
Diffstat (limited to 'ext/mysqli')
-rw-r--r--ext/mysqli/mysqli_api.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index b2ca22a998..b4948acdbb 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -105,7 +105,11 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned in
break;
case 'i': /* Integer */
- bind[ofs].buffer_type = (sizeof(long) > 4) ? MYSQL_TYPE_LONGLONG : MYSQL_TYPE_LONG;
+#if SIZEOF_LONG==8
+ bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG;
+#elif SIZEOF_LONG==4
+ bind[ofs].buffer_type = MYSQL_TYPE_LONG;
+#endif
bind[ofs].buffer = &Z_LVAL_PP(args[i]);
bind[ofs].is_null = &stmt->param.is_null[ofs];
break;
@@ -719,6 +723,7 @@ PHP_FUNCTION(mysqli_stmt_execute)
convert_to_double_ex(&stmt->param.vars[i]);
stmt->stmt->params[i].buffer = &Z_LVAL_PP(&stmt->param.vars[i]);
break;
+ case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_LONG:
convert_to_long_ex(&stmt->param.vars[i]);
stmt->stmt->params[i].buffer = &Z_LVAL_PP(&stmt->param.vars[i]);