Re: [RFC] Deprecations for PHP 8.6
| From: | Gina P. Banyard | Date: | Mon, 13 Jul 2026 15:54:03 +0000 |
| Subject: | Re: [RFC] Deprecations for PHP 8.6 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131891@lists.php.net to get a copy of this message | ||
On Saturday, 11 July 2026 at 21:19, Claude Pache <claude.pache@gmail.com> wrote:
> ## Passing objects for $data parameter of http_build_query()
>
> As I understand, what is proposed to be deprecated, is not only passing an object to
>
http_build_query (such as
> http_build_query((object)['a' => 'b'])), but
> also passing an array who has an object as value (possibly at some deep level) (such as
> http_build_query(['x' => (object) ['y' =>
> 'z']])). The deprecation message isn’t clear about that situation,
> because in the second case, an array is passed for argument #1 to http_build_query().
I can't comment on other people's proposal, but I tried clarifying this one as it's
one of my own.
Indeed any object encountered during the traversal will emit a deprecation, I added a possible
message to it.
I've also provided a function that allows recursively traversing arrays/objects to apply
get_object_vars() and produce a "clean" array that can be passed to http_build_query.
Hope this addresses the remark.
Best regards,
Gina P. Banyard