jadell / neo4jphp

PHP wrapper of the Neo4j REST interface
Other
532 stars 137 forks source link

Changed is_numeric to is_int #121

Closed kevinc13 closed 10 years ago

kevinc13 commented 10 years ago

Only identify explicit integer type variables, not integer strings

mrjameshamilton commented 10 years ago

The bug is still present in master and this fix should be merged.

jadell commented 10 years ago

This isn't a bug. We need to check for numeric strings, because of the use case of processing HTML form submissions or URL query params, which submit all their values as strings.

kevinc13 commented 10 years ago

However, if is_numeric is used, should the value should be cast to a numeric type before being encoded? Otherwise, Neo4j will treat the value as a string, which can result in unintended errors right?

mrjameshamilton commented 10 years ago

@jadell yes, sorry, you're right - not a bug :+1:

jadell commented 10 years ago

@kxc1013 The value is encoded as a numeric value before sending to Neo4j. That's what the is_numeric check is for. If it's not a numeric value, it's wrapped in quotes, signifying to Neo4j that this is a string property value. If it is numeric, the quotes are omitted.