jadell/neo4jphp — Issue #25: Warnings with ExecuteGremlinQuery
Author: pierredewilde
Created: 2011-11-24 07:52:35+00:00
State: open

Gremlin scripts may return other types than array.

For instance, executing ```g.v(1).name``` will return

Warning: array_key_exists() expects parameter 2 to be array, string given in /Users/Pierre/Sites/EC2/survey/lib/Everyman/Neo4j/Command/ExecuteGremlinQuery.php on line 89

Warning: Invalid argument supplied for foreach() in /Users/Pierre/Sites/EC2/survey/lib/Everyman/Neo4j/Command/ExecuteGremlinQuery.php on line 92

To prevent those warnings, a check may be added on top of Command/ExecuteGremlinQuery.php:

if (!is_array($data)) {
$data = array($data);
}

When iterating through ResultSet, you may use f.i. ```is_object($row[0])``` to check what Gremlin returns.

Hope that makes sense for you,
Pierre