FilterManagerBundle
FilterManagerBundle copied to clipboard
Filter manager fails if given array when expected single term
I have following configuration:
ongr_filter_manager:
managers:
product_list:
filters:
- manufacturer
repository: 'es.manager.default.product'
filters:
choice:
manufacturer:
request_field: 'man'
field: manufacturer
Usually with this config URL looks like this:
/list?man=Swiss+Legend
but if for some reason you pass man
as array
/list?man[]=Swiss+Legend
filter manager fails hard. It will return 5xx code "Uncaught PHP Exception" because of "BadRequest400Exception" thrown from Elasticsearch client.
To fail in this case is OK, but we should return HttpException
with 4xx error code by ourself.
The real issue here is that we allow filter manager to send invalid query to Elasticsearch. Filter manager should have some kind of validation and make sure that user data does not generate invalid queries.