Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-731

Parse Timestamp argument as strings to accept large integers

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2.0-alpha2, 1.2.0
    • Affects Version/s: 1.1.8
    • Component/s: None
    • None

      Timestamp's increment and timestamp components are unsigned 32-bit integers (max: 4294967295). On a 32-bit platform, 2147483647 will be the largest value accepted by the constructor since PHP's integers are signed.

      It's possible for such values to exist on a 32-bit platform after unserializing a Timestamp from raw BSON, in which case it would be printed as a negative value (via ZVAL_LONG).

      On a 32-bit platform, we should accept strings for these values, as we already do for UTCDateTime's milliseconds (a signed 64-bit integer). There are no Timestamp getter methods, so we need not worry about their return values. Strings can also be returned on 32-bit for var_dump(), serialization, and var_export() purposes (PHPC-460).

            derick Derick Rethans
            jmikola@mongodb.com Jeremy Mikola
            0 Vote for this issue
            2 Start watching this issue