Uploaded image for project: 'PHP Legacy Driver'
  1. PHP Legacy Driver
  2. PHP-163

Group doesn't work correctly with initial integers and mongo.native_long = 1 in 64bit environments

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: 1.0.9
    • Fix Version/s: None
    • Component/s: pecl-mongo
    • Labels:
      None
    • Environment:
      64bit linux
      Sharded mongo 1.6.3 environment with 1.0.9 php driver
    • # Replies:
      5
    • Last comment by Customer:
      true

      Description

      If you have mongo.native_long set to 1 in 64bit environment, group will fail in reduce because initial value is not number but object and all values are concatenaed into string and not added together:

      ["count"]=> string(1003) "[object
      Object]2874742968653174343283283040123398253734093635923323133340483295743339733494073112782785112259601970261727

      Passing $initial = array('count' => new MongoInt64(0)); doesn't seem to help and the end result is the same.

      This can be worked around by passing $initial = array('count' => 0.0); but that prevents us from using 64bit integers and falling back to floating point values.

      In 32bit environment, this seems to work correctly at least with 1.0.8 and 1.0.10 drivers.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                6 years, 4 weeks, 5 days ago
                Date of 1st Reply: