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

Issue when adding array as params, corrupts rest of the params #4

Open
GoogleCodeExporter opened this issue Oct 20, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create array of two strings
2. Add array as param
3. Add a second string as param
4. Observe in debug mode that 2nd param is corrupted

What is the expected output? What do you see instead?

The 2nd param looks like a serialized pointer form? Not sure.. I get something 
like this on the php side: [Ljava.lang.String;@44f42cb8

What version of the product are you using? On what operating system?

0.3.4 on Mac

Please provide any additional information below.

In file JSONRPCClient, in method protected JSONObject doRequest(String method, 
Object[] params) throws JSONRPCException

You need to change:

            if(params[i].getClass().isArray()){
                jsonParams.put(getJSONArray((Object[])params[i]));
            }

            jsonParams.put(params[i]);

to

            if(params[i].getClass().isArray()){
                jsonParams.put(getJSONArray((Object[])params[i]));
            }
            else {
                jsonParams.put(params[i]);
            }

Then everything works as expected. 

Original issue reported on code.google.com by r...@ordbogen.com on 10 Aug 2012 at 9:15

@GoogleCodeExporter
Copy link
Author

Same problem here, fix works!
Godsend.

Original comment by timvangi...@gmail.com on 4 Sep 2012 at 5:45

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

No branches or pull requests

1 participant