Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/zendframework/zendframework#6231-fix-http-query-…
Browse files Browse the repository at this point in the history
…parameters-to-array-cast-on-hhvm'

Close zendframework/zendframework#6231
Forward port zendframework/zendframework#6231
  • Loading branch information
Ocramius committed Nov 14, 2014
4 parents 1feb4cf + ffd4e9b + 2aef442 + 3cec1b8 commit 40bd5b8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ public function send(Request $request = null)

if (!empty($queryArray)) {
$newUri = $uri->toString();
$queryString = http_build_query($query, null, $this->getArgSeparator());
$queryString = http_build_query($queryArray, null, $this->getArgSeparator());

if ($this->config['rfc3986strict']) {
$queryString = str_replace('+', '%20', $queryString);
Expand Down
32 changes: 32 additions & 0 deletions test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,36 @@ public function testCanSpecifyCustomAuthMethodsInExtendingClasses()
$client
);
}

/**
* @group 6231
*/
public function testHttpQueryParametersCastToString()
{
$client = new Client();

/* @var $adapter \PHPUnit_Framework_MockObject_MockObject|\Zend\Http\Client\Adapter\AdapterInterface */
$adapter = $this->getMock('Zend\Http\Client\Adapter\AdapterInterface');

$client->setAdapter($adapter);

$request = new Request();

$request->setUri('http://example.com/');
$request->getQuery()->set('foo', 'bar');

$response = new Response();

$adapter
->expects($this->once())
->method('write')
->with(Request::METHOD_GET, 'http://example.com/?foo=bar');

$adapter
->expects($this->any())
->method('read')
->will($this->returnValue($response->toString()));

$client->send($request);
}
}

0 comments on commit 40bd5b8

Please sign in to comment.