-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 0.6.3
-
Component/s: None
-
None
This only pertains to Phongo on PHP 5.x, since PHP7 will support 64-bit integers on all platforms, and HHVM requires a 64-bit platform. Currently, the driver logs a warning and stores the 64-bit integer as a string:
#if SIZEOF_LONG == 4 # define ADD_INDEX_INT64(zval, index, value) \ if (value > LONG_MAX || value < LONG_MIN) { \ char *tmp; \ int tmp_len; \ mongoc_log(MONGOC_LOG_LEVEL_WARNING, MONGOC_LOG_DOMAIN, "Integer overflow detected on your platform: %lld", value); \ tmp_len = spprintf(&tmp, 0, "%lld", value); \ add_index_stringl(zval, index, tmp, tmp_len, 0); \ } else { \ add_index_long(zval, index, val); \ } # define ADD_ASSOC_INT64(zval, key, value) \ if (value > LONG_MAX || value < LONG_MIN) { \ char *tmp; \ int tmp_len; \ mongoc_log(MONGOC_LOG_LEVEL_WARNING, MONGOC_LOG_DOMAIN, "Integer overflow detected on your platform: %lld", value); \ tmp_len = spprintf(&tmp, 0, "%lld", value); \ add_assoc_stringl(zval, key, tmp, tmp_len, 0); \ } else { \ add_assoc_long(zval, key, value); \ } #else # define ADD_INDEX_INT64(zval, index, value) add_index_long(zval, index, value) # define ADD_ASSOC_INT64(zval, key, value) add_assoc_long(zval, key, value); #endif
If users do not pay attention to logging, they could inadvertently convert a 64-bit integer to a string when round-tripping a document through the driver on a 32-bit platform. Rather than keep a MongoInt64-like class around, we would rather just throw an exception when working with such values.
This may cause problems for any command result that returns a cursor ID, since those are 64-bit and it's unlikely that the driver would know the context of the field path to deserialize it into a CursorId object.
- related to
-
PHPC-544 Consult SIZEOF_ZEND_LONG for 64-bit integer support
- Closed
-
PHPC-197 Issues with 64bit IDs in getUpsertedIDs
- Closed
-
PHPC-1211 Create Int64 class to wrap 64-bit integers on 32-bit platforms
- Closed
-
PHPC-64 Implement BSON 64-bit integer type
- Closed
-
PHPC-67 Determine how BSON deserialization of 32/64-bit integers should occur
- Closed
-
PHPLIB-356 Audit documentation for possible BSON 64-bit integer return values
- Closed