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

Consult SIZEOF_ZEND_LONG for 64-bit integer support

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 1.1.3
    • Affects Version/s: 1.1.2
    • Component/s: None
    • None
    • Environment:
      Windows 7, 64-bit
      Apache 2.4.18, 64-bit TS
      PHP 7.0.2, 64-bit TS
      Mongo 3.2.0
      MongoDB driver 1.1.1 and 1.1.2

      I can't speak for other platforms, but with my current setup trying to do [$set => ["TestInt" => 4294967295]] will save an Int32 in the database with value -1 (so it wraps around instead of truncating).

      $inc suffers from the same problem as $set. That is, if I try to [$inc => ["TestInt" => 4294967295]] I will actually subtract 1 from TestInt. Further testing has revealed that queries suffer from the same problem: If I were to make a query with a filter like "TestInt" => ['$lt' => 4294967295], I'll actually be looking for documents where TestInt is less than -1.

      Truncation of 64-bit integers when converting BSON to PHP values may also result in property name corruption (see PHPC-592).

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: