jadell/neo4jphp — Issue #26: get exception in batch with string "  and \
Author: readic
Created: 2011-11-28 10:44:01+00:00
State: open

// php code
$client = new Client(new Transport());
$batch = new Batch($client);
$index = new Index($client, Index::TypeNode, 'index_test');

$name = 'string \ and "test"';
// escape part
//$name = str_replace('\\\\', '\\\\\\\\', $name);
//$name = str_replace('"', '\"', $name);

$node = new Node($client);
$node->setProperty('NAME', $name);
$batch->save($node);

//$batch->addToIndex($index, $node, 'NAME', $node->getProperty('NAME'));
$batch->commit();
//end of code

if there are \ or " string in property of node or value of index, i got exception.
the request of commit will be like this below and it get error.
post /db/data/batch[{"method":"POST","to":"\/node","body":{"NAME":"string\\\\ and \"test\""},"id":0}]

then i uncomment the escape part of code, the result of request will be like this:
post /db/data/batch[{"method":"POST","to":"\/node","body":{"NAME":"string\\\\\\\\ and \\\\\\"test\\\\\\""},"id":0}]
this runs well.

But it runs correctly when i use $node->save() what ever what string it is.
Only get error with batch.
i'm not sure if this is a problem of php or server of neo4j.

i'm using Neo4j 1.5.M02