arrays - array_flip():Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() -
i have migrated module drupal7 (on php version 5.3.1) , getting following errors:
* warning: array_flip() [function.array-flip]: can flip string , 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 flip string , 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 flip string , 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 flip string , 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 flip string , 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 flip string , 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 flip string , 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 flip string , integer values! in drupaldefaultentitycontroller->cacheget() (line 354 of c:\users\akulkarni\desktop\xampp\htdocs\servicecasting\includes\entity.inc).
i have tried upgrading other modules , core latest versions 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 not able figure out causing error?
edit:
according http://php.net/manual/en/function.array-flip.php,
array_flip() returns array in flip order, i.e. keys trans become values , values trans become keys.
note values of trans need valid keys, i.e. need either integer or string. warning emitted if value has wrong type, , key/value pair in question not flipped.
i have done var_dump($ids);
before line 178 in entity.inc ( $passed_ids = !empty($ids) ? array_flip($ids) : false;
)
and looks me key/value pair 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)
the common cause of error using something_load() function array argument. not supported anymore because load_multiple() functions need used now.
example in d6:
<?php // using array id discouraged in d6 still worked. $user = user_load(array('uid' => 1)); $user = user_load(array('name' => 'admin')); ?>
drupal 7:
<?php // argument load() function *must* single id $user = user_load(1); // querying attribute bit more complex. // note using reset(user_load_multiple() directly not e_strict compatible. $users = user_load_multiple(array(), array('name' => 'admin')); $user = reset($users); ?>
so, easiest way catch these search "_load(array".
Comments
Post a Comment