-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.1.5
-
Component/s: None
-
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.
- is related to
-
PHPLIB-176 MongoRegex replacement
- Closed
- related to
-
PHPC-847 Implement comparison handler for Decimal128
- Closed