8p / EightPointsGuzzleBundle

⛽️ Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony
MIT License
440 stars 71 forks source link

Query option breaks BC if one doesn't use it #39

Closed nikita2206 closed 8 years ago

nikita2206 commented 8 years ago

Apparently commit d79f2fc324c5f7d58e1169fb857fd14beb5e760b (in version 4.5.0) indirectly broke a simple use case when not using this option at all.

If you try to pass a $uri to the Client#request() method (or any of the request family for that matter) which contains query, Guzzle will disregard it and instead it will use query from the $options array. Even though we didn't put query in the $options array, GuzzleBundle put it in the default options array (or default config - Client constructor's first argument) as an empty array() (because symfony configuration component provides default value if one is not present) and after guzzle merges $options with $this->config it now has a query element.

Should be easy to fix in GuzzleExtension by unsetting query from $options array after line 54 if it is an empty array.

yoedumar commented 8 years ago

I had the same issue after update to 4.5.0 Rewrite all my client->get($uri) where $uri had a query string (/api?someparam=value) with client->get($uriWithoutQueryString, array('query' => array('someparam' => 'value')));

florianpreusner commented 8 years ago

Okay, that's a bug, cause it was not planned to change the behavior. Will check that later.

derrabus commented 8 years ago

We just ran into the same regression. For now, we rolled back to v4.4.1, which worked fine for us.

florianpreusner commented 8 years ago

Released new version: https://github.com/8p/GuzzleBundle/releases/tag/v4.5.1