jadell / neo4jphp

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

Batch Commit Fails when property value contains '\' #53

Closed braunsquared closed 11 years ago

braunsquared commented 12 years ago

Due to how Neo4J handles batch processing the escape sequence needed for '\' is awkward. Currently, any batch commit which contains a property value that contains a '\' fails with an invalid argument exception. Removing the '\' from the value seems to make it work ok but is a terrible solution. The only solution I've been able to find so far is:

In Everyman\Neo4j\Transport.php

$encoded = json_encode($data);
$encoded = str_replace('\\\\', '\\\\\\\\', $encoded);
return $encoded;

The downfall is this issue only happens during a batch commit, so the encoding fix only needs to occur on batch related data. We currently only commit in batches so we are good to go, but a better work around should probably be implemented.

Otherwise, fantastic library.

jadell commented 12 years ago

This looks like a duplicate of https://github.com/jadell/neo4jphp/issues/26

The problem was supposedly fixed on the Neo4j server side ,which is why I closed the issue, but it seems to have been re-opened since then (https://github.com/neo4j/community/issues/113).

Are you still seeing this with the current stable version of Neo4j (or a recent milestone version?) Also, in the webadmin console, can you try the two POST tests I commented to demonstrate the problem?

Can you please add a comment on the Neo4j issue as well, with detail about your use case, to let them know this is still affecting users?

I'd prefer to not fix this in Neo4jPHP, because the problem is in the server and a client-side fix will break as soon as they fix it on the server-side.

braunsquared commented 12 years ago

Thanks for the quick response. My apologies for the duplicate issue, I thought I had searched for it before and didn't find it.

I have work arounds locally which are working for the time being.

For the record, we are using a slightly older stable build of Neo4J Enterprise Edition which is version 1.5 at the time of this writing. I will upgrade to the latest stable build and test again.

Thanks again.