Skip to content

Commit 2874bf6

Browse files
authored
Merge pull request #24 from uh-zuh/fix-uint64-type-cast
fix uint64 type cast
2 parents c12c158 + 8e2b6c9 commit 2874bf6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/QueryResult.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,17 @@ protected function fillRows($rows)
206206
case 'INT32':
207207
case 'INT64':
208208
case 'UINT32':
209-
case 'UINT64':
210209
$_row[$column['name']] = (int)($value);
211210
break;
212211

212+
case 'UINT64':
213+
$value_int = (int)$value;
214+
if ($value_int === PHP_INT_MAX && PHP_INT_SIZE === 8) {
215+
$value_int = (int)bcsub($value, '18446744073709551616', 0);
216+
}
217+
$_row[$column['name']] = $value_int;
218+
break;
219+
213220
default:
214221
$_row[$column['name']] = $value;
215222
}

0 commit comments

Comments
 (0)