http_build_query(): surprise!

Did you know that PHP’s http_build_query() drops any key from your query array if the value is NULL? I wonder how many subtle API client bugs are caused by this behavior.

The workaround is easy, just set values that should be intentionally empty to boolean FALSE, integer 0, or an empty string.

Written on September 30, 2011