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

Implement comparison handlers for BSON types

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2.0
    • Affects Version/s: 1.1.5
    • Component/s: None
    • Labels:
      None

      Reported originally at PHPLIB-176 by shadizar:

      Hi. I cannot compare two regex objects (==) because the return value is always true, even when the patterns or flags are different. I could do a === comparison but that will always return false even when the patterns are the same.

      I'm running a query optimizer that looks for duplicate filters, nested $or's, etc. With the old driver I did not have this issue because comparing two MongoRegex objects would return the right result.

      Here's an example of my code:

      <?php
      use \MongoDB\BSON\Regex;
      var_dump($a == $b); // returns true, should be false
      var_dump($a === $b); // returns false
      var_dump($a > $b); // returns false
      var_dump($a < $b); // returns false, should be true
      

      --------

      The HHVM driver handles this correctly already.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            derick Derick Rethans
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: