libgraviton / php-rql-parser

A PHP RQL Parsing Library
15 stars 4 forks source link

Error parsing "eq(field,fieldValue)&gt(fieldName,55)" #1

Closed izziaraffaele closed 9 years ago

izziaraffaele commented 9 years ago

I cannot figure out why it cannot parse a query string like this "eq(field,fieldValue)&gt(fieldName,55)" that is the query used in your documentation

narcoticfresh commented 9 years ago

Can you give me more details on your use case? Are you using the MongoDb queriable or which? Provide some code please and the example documents you have in your database..

izziaraffaele commented 9 years ago

Actually I'm building my own queriable but seems that the parser can't parse that string correctly. I'm taking the query from a GET url parameter, I'm decoding it and passing to the parser

eq(field,fieldValue) --> works eq(field,fieldValue)|gt(fieldName,55) --> works eq(field,fieldValue)&gt(fieldName,55) --> doesn't works

narcoticfresh commented 9 years ago

Hm.. are you sure eq(field,fieldValue)|gt(fieldName,55) (OR) really works..

I discovered an issue which could cause your case - it seems "55" gets applied to the Queriable as string type, not integer. This leads to an error (saying, it doesn't work) with the MongoDB backend..

Could it be the data source your applying your Queriable too doesn't allow to filter "greather then" passing a string to a numeric field?

izziaraffaele commented 9 years ago

Investigating a bit more I discovered that my backend framework adds ":" to the string in certain cases while applying XSS filters. So this "eq(field,fieldValue)&gt(fieldName,55)" becomes inexplicably this "eq(field,fieldValue)&gt:(fieldName,55)" that obviously brakes your parser.

So there is are not issues with php-rql-parser but it's just an issue on my framework. I'm really sorry for this "fake" issue...