array_flip():只能翻转字符串和整数值!in DrupalDefaultEntityController->load()
我最近将我的模块迁移到Drupal7(在PHP版本5.3.1上),现在我收到以下错误:
* 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).
我还尝试将其他模块和核心升级到最新版本,如这里所述 http://drupal.org/node/1022736
实体 7.x-1.x-dev (2011 年 1 月 24 日), views 7.x-3.x-dev (2011-Jan-22), Drupal core 7.x-dev (2011-Jan-24), profile2 7.x-1.0-beta1, 参考文献 7.x-2.x-dev (2011-Jan-14), ctools 7.x-1.0-alpha2
我无法弄清楚究竟是什么导致了此错误?
编辑:
根据 http://php.net/manual/en/function.array-flip.php,
array_flip() 按翻转顺序返回数组,即来自 trans 的键成为值,来自 trans 的值变为键。
请注意,trans 的值必须是有效的键,即它们必须是整数或字符串。如果值的类型错误,则会发出警告,并且有问题的键/值对不会被翻转。
我已经在entity.inc(var_dump($ids);
$passed_ids = !empty($ids) ? array_flip($ids) : FALSE;
)
在我看来,键/值对总是采用正确的格式(?)。
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)