Rewrite query string parsing to avoid use parse_str
I've encountered the same problems described in #756, so I've checked how PHP implemented the parse string filter and rewrote it in PHP to avoid using parse_str itself.
Spaces and dots are preserved in the resulting array keys. The behavior of the parser on case of unclosed bracket is retained too.
This is quite a complex change and somewhat a maintenance overhead for bref. I'll need some time before I can review this thoroughly.
It would be good to know how many people are having issues with this to help with prioritization.
Hi,
We are having this problem with Api Platform too.
curl -X 'GET'
'https://xxxxxxx/api/v4/group_classes?page=1&activity.id=6'
-H 'accept: application/ld+json'
is handled with this query string :
"hydra:view": { "@id": "/api/v4/group_classes?activity_id=6", "@type": "hydra:PartialCollectionView" },
The usage of dot is a basic feature in Api Plaform : https://api-platform.com/docs/core/filters/#filtering-on-nested-properties
I am amazed that so few people have encountered the problem
For more info, Api Platform have an implementation to handle this too : https://github.com/api-platform/core/blob/10827bb570c44cdee2c1bb7a307a8a18df9b4f00/src/Util/RequestParser.php#L50 Solution referenced in comments : https://stackoverflow.com/questions/68651/get-php-to-stop-replacing-characters-in-get-or-post-arrays/18209799#18209799
@Cafeine42 nice, that sounds interesting, especially knowing it's already used by API Platform at scale. And it looks "simple" too.
A PR with that implementation (with correct @author attribution) could be easier to merge probably.
IMHO the "api platform" solution sounds hackish, is based on the same function that caused the original bug and is not really performant (~50% slower in my tests).
Could be "simpler" to see, but in an environment where every millisecond counts and it's billed, performance should be taken into consideration.
Thanks for all the effort! This has been fixed in #1437