1

I tried a lot to get this warning solved, but end up with nothing. Can anyone look into this warning issue.

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /var/www/html/std-build/httpdocs/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /var/www/html/std-build/httpdocs/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 388 of /var/www/html/std-build/httpdocs/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /var/www/html/std-build/httpdocs/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 388 of /var/www/html/std-build/httpdocs/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /var/www/html/std-build/httpdocs/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 388 of /var/www/html/std-build/httpdocs/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /var/www/html/std-build/httpdocs/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 388 of /var/www/html/std-build/httpdocs/includes/entity.inc).
  • It works if $content_type is defined ahead – Paul Bönisch Sep 11 '15 at 9:34
1

This patch is work for me. Try this out

  • Thanks a ton. But If you have seen warnings above mentioned, there are two types, first is load() and other one is cacheGet() type. load() one is done but what about Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 388 of /var/www/html/std-build/httpdocs/includes/entity.inc). – Sugandh Khanna Sep 11 '15 at 12:43
  • What should I do for Cache warning?? – Sugandh Khanna Sep 14 '15 at 5:39
  • which drupal version are you using? – vgoradiya Sep 14 '15 at 6:12
  • try this one path drupal.org/files/issues/drupal7.entity-system.1525176-143.patch this will work for you. – vgoradiya Sep 14 '15 at 6:17
2

This is related mostly to the issue in your code or bug in the module which you're using.

Basically you should validate your DrupalEntityControllerInterface implementation, and you should not patch your Drupal core as suggested by @vgoradiya since it's not a bug in Drupal core.

Consensus seems to be that issues arise with bad data and should be corrected at the offending module level, not by adding a safeguard to DrupalDefaultEntityController that would mask deeper problems. Having an error here is a warning to developers that they are using the D7 APIs incorrectly. - @jessebeach

So the challenge should be to identify which module implements Entity API incorrectly.

See also:


If you're developer of the module which causing the issue, please check the followings:

  • Make sure your array won't contain NULL values, otherwise use the following trick:

    $arr = drupal_map_assoc($arr, function($v) { return (string) $v; });
    
  • Check the Examples module (entity_example) for Developers how to implement entities.

  • You're loading entities using the right $ids structure.
  • Use debugger or debug_backtrace() to debug the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.