diff --git a/cake/libs/http_socket.php b/cake/libs/http_socket.php index 76d12d7102a..793618ece27 100644 --- a/cake/libs/http_socket.php +++ b/cake/libs/http_socket.php @@ -672,7 +672,7 @@ function parseQuery($query) { foreach ($items as $item) { if (strpos($item, '=') !== false) { - list($key, $value) = explode('=', $item); + list($key, $value) = explode('=', $item, 2); } else { $key = $item; $value = null; diff --git a/cake/tests/cases/libs/http_socket.test.php b/cake/tests/cases/libs/http_socket.test.php index b3fa948b14d..2dbc193d969 100644 --- a/cake/tests/cases/libs/http_socket.test.php +++ b/cake/tests/cases/libs/http_socket.test.php @@ -878,6 +878,28 @@ function testParseUri() { 'host' => 'www.google.com', 'port' => 8080, )); + + $uri = $this->Socket->parseUri('http://www.cakephp.org/?param1=value1¶m2=value2%3Dvalue3'); + $this->assertIdentical($uri, array( + 'scheme' => 'http', + 'host' => 'www.cakephp.org', + 'path' => '/', + 'query' => array( + 'param1' => 'value1', + 'param2' => 'value2=value3' + ) + )); + + $uri = $this->Socket->parseUri('http://www.cakephp.org/?param1=value1¶m2=value2=value3'); + $this->assertIdentical($uri, array( + 'scheme' => 'http', + 'host' => 'www.cakephp.org', + 'path' => '/', + 'query' => array( + 'param1' => 'value1', + 'param2' => 'value2=value3' + ) + )); } /** * Tests that HttpSocket::buildUri can turn all kinds of uri arrays (and strings) into fully or partially qualified URI's