From: Jani Taskinen Date: Mon, 29 Oct 2007 09:50:49 +0000 (+0000) Subject: - Fixed invalid handling of float value passed to an integer field on 64bit machine X-Git-Tag: RELEASE_2_0_0a1~1531 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aed3360625f75e5b42fb95ccebb84274893e94fe;p=php - Fixed invalid handling of float value passed to an integer field on 64bit machine --- diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index cf6e04eac5..23dd0090ef 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; @@ -735,6 +739,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]);