Re: [RFC] Add parse_query_string as an alternative to parse_str
| From: | Ayesh Karunaratne | Date: | Fri, 06 Aug 2021 09:28:11 +0000 |
| Subject: | Re: [RFC] Add parse_query_string as an alternative to parse_str | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115639@lists.php.net to get a copy of this message | ||
> I agree about the _string suffix removal. However, I know we have
> parse_url() already, but parse_query() might be too generic. I would
> suggest adding "http" to the name. And as we already have
> http_build_query() I would rather see http_parse_query().
>
+1 for http_parse_query() as it sounds a lot more natural and consistent.
> parse_str assumes that the query separator is always a "&" which reduces
> its usage to only parsing query using that particular character. Again this
> might be seen as an edge case but no RFC prevents using any other
> character. If you where to use another character you are bound to use some
> userland code workaround to then feed the "normalized" string to parse_str
Both
http_build_query and parse_str respect the
arg_separator.input [INI
setting](https://www.php.net/manual/en/ini.core.php#ini.arg-separator.input).
If we were to go for a http_parse_query, I think it makes sense to
support the same behavior and parameters.
Thank you,
Ayesh.