Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array keys are encoded incorrectly #1

Open
intypica opened this issue Mar 24, 2010 · 1 comment
Open

Array keys are encoded incorrectly #1

intypica opened this issue Mar 24, 2010 · 1 comment

Comments

@intypica
Copy link

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
Copy link
Author

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

descending=true

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant