I have recently migrated my module to Drupal7 (on PHP Version 5.3.1) and now I am getting following errors:
* Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of C:\Users\akulkarni\Desktop\xampp\htdocs\servicecasting\includes\entity.inc).
* Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of C:\Users\akulkarni\Desktop\xampp\htdocs\servicecasting\includes\entity.inc).
* Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of C:\Users\akulkarni\Desktop\xampp\htdocs\servicecasting\includes\entity.inc).
* Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of C:\Users\akulkarni\Desktop\xampp\htdocs\servicecasting\includes\entity.inc).
* Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of C:\Users\akulkarni\Desktop\xampp\htdocs\servicecasting\includes\entity.inc).
* Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of C:\Users\akulkarni\Desktop\xampp\htdocs\servicecasting\includes\entity.inc).
* Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of C:\Users\akulkarni\Desktop\xampp\htdocs\servicecasting\includes\entity.inc).
* Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of C:\Users\akulkarni\Desktop\xampp\htdocs\servicecasting\includes\entity.inc).
I have also tried upgrading other modules and core to latest versions as mentioned here http://drupal.org/node/1022736
entity 7.x-1.x-dev (2011-Jan-24), views 7.x-3.x-dev (2011-Jan-22), Drupal core 7.x-dev (2011-Jan-24), profile2 7.x-1.0-beta1, references 7.x-2.x-dev (2011-Jan-14), ctools 7.x-1.0-alpha2
I am not able to figure out what is exactly causing this error?
Edit:
According to http://php.net/manual/en/function.array-flip.php,
array_flip() returns an array in flip order, i.e. keys from trans become values and values from trans become keys.
Note that the values of trans need to be valid keys, i.e. they need to be either integer or string. A warning will be emitted if a value has the wrong type, and the key/value pair in question will not be flipped.
I have done the var_dump($ids);
before line 178 in entity.inc ( $passed_ids = !empty($ids) ? array_flip($ids) : FALSE;
)
And it looks to me that key/value pair is always in correct format(?).
array
0 =>
array
'nid' => string '6' (length=1)
array
0 =>
array
'uid' => string '1' (length=1)
array
0 => string '0' (length=1)
array
0 =>
array
'nid' => string '7' (length=1)
array
0 =>
array
'nid' => string '4' (length=1)
array
0 =>
array
'nid' => string '8' (length=1)
array(0 => 'a')
, but notarray(0 => array(0 => 'a'))
because the nested array would have to become the array key. – Iodize