summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Richter <georg@php.net>2006-03-14 15:53:16 +0000
committerGeorg Richter <georg@php.net>2006-03-14 15:53:16 +0000
commit829642a0b733a57b83f25ef99a9fa6893877599d (patch)
treef727cf37588bf3adb4f3e40e912f969f780dff2a
parent98bacb0e219eeaa865c09f17f4c07b50a848aa26 (diff)
downloadphp-git-829642a0b733a57b83f25ef99a9fa6893877599d.tar.gz
fixed a 64-bit problem reported by Pierre
-rw-r--r--ext/mysqli/mysqli_api.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index eec7a67b85..5bd1953528 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -295,7 +295,7 @@ PHP_FUNCTION(mysqli_stmt_bind_result)
convert_to_long_ex(args[i]);
stmt->result.buf[ofs].type = IS_LONG;
stmt->result.buf[ofs].buflen = 0;
- stmt->result.buf[ofs].val = (char *)emalloc(sizeof(long));
+ stmt->result.buf[ofs].val = (char *)emalloc(sizeof(int));
bind[ofs].buffer_type = MYSQL_TYPE_LONG;
bind[ofs].buffer = stmt->result.buf[ofs].val;
bind[ofs].is_null = &stmt->result.is_null[ofs];
@@ -663,7 +663,7 @@ PHP_FUNCTION(mysqli_stmt_fetch)
if (!stmt->result.is_null[i]) {
switch (stmt->result.buf[i].type) {
case IS_LONG:
- if ((sizeof(long) ==4) && (stmt->stmt->fields[i].type == MYSQL_TYPE_LONG)
+ if ((stmt->stmt->fields[i].type == MYSQL_TYPE_LONG)
&& (stmt->stmt->fields[i].flags & UNSIGNED_FLAG))
{
/* unsigned int (11) */
@@ -684,7 +684,11 @@ PHP_FUNCTION(mysqli_stmt_fetch)
break;
}
}
- ZVAL_LONG(stmt->result.vars[i], *(int *)stmt->result.buf[i].val);
+ if (stmt->stmt->fields[i].flags & UNSIGNED_FLAG) {
+ ZVAL_LONG(stmt->result.vars[i], *(unsigned int *)stmt->result.buf[i].val);
+ } else {
+ ZVAL_LONG(stmt->result.vars[i], *(int *)stmt->result.buf[i].val);
+ };
break;
case IS_DOUBLE:
memcpy(&dval, stmt->result.buf[i].val, sizeof(dval));