sopha
sopha copied to clipboard
Array keys are encoded incorrectly
http_build_query encodes JSON arrays incorrectly, resulting in unexpected behavior when using arrays as view keys.
Example:
$params = array( "startkey" => array( 'foo' ), "endkey" => array( 'foo', array() ) );
Is expected to produce:
?startkey=['foo']&endkey=['foo',[]]
But produced completey encoded strings instead:
startkey=%5B%22foo%22%5D&endkey=%5B%22foo%22%2C%5B%5D%5D
Here is a patch:
http://pastebin.com/C3aDSxx1
There was also an issue with passing boolean keys as couchdb expects them. For example:
descending=true
updated diff: http://pastebin.com/QY4yaPR2