PHP 5.3 compatible way to build query strings

The PHP_QUERY_RFC3986 constant has been introduced with PHP 5.4.0.
Therefore, http_build_query() cannot be used to encode query params
according to RFC 3986 (http_build_query() follows RFC 1738 by
default) in a way that is compatible with PHP 5.3.