Skip to content
This repository has been archived by the owner on Aug 6, 2020. It is now read-only.

java.lang.String cannot be cast to java.lang.Number while $request->get('limit', 50) #57

Closed
AlexanderMatveev opened this issue Jan 14, 2015 · 3 comments · Fixed by #58
Closed

Comments

@AlexanderMatveev
Copy link

When passing a GET variable (http://localhost:8080/graph?limit=10) to https://github.com/neo4j-contrib/developer-resources/blob/gh-pages/language-guides/php/neo4jphp/index.php#L19, getting this:

[message] => java.lang.String cannot be cast to java.lang.Number
[exception] => ClassCastException
[fullname] => java.lang.ClassCastException

Screenshot: http://screenshare.ru/dlMT0U8f

Just a newbie in neo4j

@jexp
Copy link
Contributor

jexp commented Jan 14, 2015

Hey @jadell could you have a look?

@jadell
Copy link
Contributor

jadell commented Jan 14, 2015

The issue here is that the limit parameter is being passed from the application to the Neo4j REST server encoded as a JSON string. This is one of the consequences of PHP (a weakly typed language) trying to talk to Java (a strongly typed langauge.) I will submit a pull request for the example code that casts the parameter to an integer before sending it. It is up to @jexp and the rest of the neo4j crew whether they want to do numeric string-to-integer conversions on the server side.

@AlexanderMatveev
Copy link
Author

@jexp @jadell Thanks!

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

Successfully merging a pull request may close this issue.

3 participants