-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We need to do a better job of converting SQL LIKE expression into Regex #719
Comments
Should be fixed in master :) |
Brilliant, thanks. This still doesn't cover |
It should. All |
Bah, yes sorry, I was just testing and realised that. Excellent! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In \Jenssegers\Mongodb\Query\Builder::compileWhereBasic, the conversion from an SQL LIKE expression to a MongoRegex is incomplete. A quick search revealed a more complete implementation here: http://stackoverflow.com/a/11436643/4186945 Specifically, it should at least be calling preg_quote on the input parts that aren't operators (% and _). You could leave quoting % and _ up to the developer, since that's what one would have to do with a SQL DB.
This bit me when trying to do a like query on an email address that contained a + character, that ends up going unescaped. For now I'm just running preg_quote myself, but unfortunately that will break once this is fixed. :-/
The text was updated successfully, but these errors were encountered: