summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysqli/mysqli_api.c')
-rw-r--r--ext/mysqli/mysqli_api.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 4dcc3d4f94..e37a120a00 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -643,7 +643,11 @@ PHP_FUNCTION(mysqli_fetch)
my_ulonglong lval;
memcpy (&lval, stmt->bind[i].buffer, sizeof(my_ulonglong));
if (lval != (long)lval) {
- sprintf((char *)&tmp, "%llu", lval);
+ /* even though lval is declared as unsigned, the value
+ * may be negative. Therefor we cannot use %llu and must
+ * user %lld.
+ */
+ sprintf((char *)&tmp, "%lld", lval);
ZVAL_STRING(stmt->vars[i], tmp, 1);
} else {
ZVAL_LONG(stmt->vars[i], lval);