sopha icon indicating copy to clipboard operation
sopha copied to clipboard

Array keys are encoded incorrectly

Open intypica opened this issue 15 years ago • 1 comments

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

intypica avatar Mar 24 '10 16:03 intypica

There was also an issue with passing boolean keys as couchdb expects them. For example:

descending=true

updated diff: http://pastebin.com/QY4yaPR2

intypica avatar Mar 24 '10 16:03 intypica