guzzle/guzzle — pull request #123 by pda (2012-08-17 04:26:50+00:00)
Title: UriTemplate suppresses key name for empty arrays.

Example of correction:

params: array()
template: /path{?params*}
previous result: /path?params=
correct result: /path

Unfortunately PHP is unable to distinguish between an empty list array
and an empty associative array. However this doesn't matter, because the
empty case of either of these is considered "undefined" by the spec,
expanding to an empty string.

http://tools.ietf.org/html/draft-gregorio-uritemplate-08#section-2.3

> A variable defined as a list value is considered undefined if the
> list contains zero members. A variable defined as an associative
> array of (name, value) pairs is considered undefined if the array
> contains zero members or if all member names in the array are
> associated with undefined values.

http://tools.ietf.org/html/draft-gregorio-uritemplate-08#section-3.2.1

> A variable that is undefined (Section 2.3) has no value and is
> ignored by the expansion process. If all of the variables in an
> expression are undefined, then the expression's expansion is the
> empty string.

The two test cases I've added are directly from [section 3.2.5](http://tools.ietf.org/html/draft-gregorio-uritemplate-08#section-3.2.5) of the spec.