-
Notifications
You must be signed in to change notification settings - Fork 141
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
Error when passing an array as sort direction parameter in ORM pagination #322
Comments
#306 might be related, but is in a very early discussion stage |
IMHO, using an That's surprising for developers working on this library, since you wonder (no obvious hints) where the type conversion happens. Also, from looking at the code in the event subscribers, you might also ask whether or not this type-checking takes place at all. Includes static analysis tools that may not see the actual types. What about using |
Unfortunately the RFC in #306 didn't gain momentum, but anyway the implementation already started, and in the 4.x branch you can access arguments using your own implementation. |
The latest major version implemented what proposed in #306 |
Not sure whether #306 – an abstraction on top of the request parameters – is what was asked for in the first place. Anyways, since Symfony 6 (symfony/symfony#37265) the |
@mpdude this is currently a problem, because ArgumentAccessInterface doesn't allow for array values in |
Affected version: 3.6.0 (possibly 4.1.0 as well)
When using ORM pagination and calling something like
http://localhost/galery/page/2?direction[test]=1&sort=columnname
, thedirection
parameter becomes an array. This will result in an array to string conversion error in the 3.6.0 QuerySubscriber. The 4.1.0 QuerySubscriber looks like it could be affected, too.First, I thought about a quick
is_string()
check. But then I noticed that other places like the SlidingPagination in the KnpPaginatorBundle rely on thedirection
parameter to be a string, too. It seems that more than one class gets the value directly from the request. So my current idea is fixing the request with a kernel event subscriber like this draft:What do you think? I'm not convinced this steamroller approach is an elegant solution.
I'd be happy to open a PR when we have a good notion on how to do it. (If so, could I target a 3.x branch or are PRs only accepted on the current major?)
The text was updated successfully, but these errors were encountered: