php-redis-graph icon indicating copy to clipboard operation
php-redis-graph copied to clipboard

Creating nodes Error

Open chriscconte opened this issue 6 years ago • 6 comments

In Result.php line 98:
                                                                 
  array_combine() expects parameter 1 to be array, string given  

When I am creating multiple nodes, using addNode, and commit, I get the above error. I am using PHP 7.2.15, redis-graph 1.99, and redis 5.05

chriscconte avatar Jul 31 '19 10:07 chriscconte

A sample response object that creates this error:

  [0]=>
  array(4) {
    [0]=>
    string(15) "Labels added: 1"
    [1]=>
    string(18) "Nodes created: 514"
    [2]=>
    string(20) "Properties set: 3054"
    [3]=>
    string(52) "Query internal execution time: 9.525500 milliseconds"
  }
}

The code expects there to be arrays of depth 3, but in this instance we only have an array of depth 2!

chriscconte avatar Jul 31 '19 10:07 chriscconte

run into this too with PHP 7.3

rolandinsh avatar Aug 05 '19 13:08 rolandinsh

src\Redis\Graph\Query\Result.php line 91 if (!isset($response[1]) || !is_array($response[1])) { line 94 $this->keys = $response[0]; line 95 foreach ($response[1] as $val) { line 102 if (!isset($response[2]) || !is_array($response[2])) { line 106 foreach ($response[2] as $line) {

q4323636 avatar Aug 07 '19 10:08 q4323636

I think this is caused by changes in redis-graph: By reverting from 1.99, to 1.2.0, my issue was resolved!

chriscconte avatar Aug 20 '19 15:08 chriscconte

php 7.3 works also with RedisGraph 1.2.2 (using Docker version) and this client

rolandinsh avatar Sep 10 '19 12:09 rolandinsh

dirty (and untested) fix: https://github.com/rolandinsh/php-redis-graph/commit/17a51926ca2d5911e92208d2a68b6f0341e3fb77

"works on my machine"

rolandinsh avatar Oct 15 '19 17:10 rolandinsh