After updating module to version 2.3 5 out of 10 sites display the following warnings when trying to run database updates:

Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIControllerExportable->load() (line 742 of .../sites/all/modules/entity/includes/entity.controller.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 219 of .../sites/all/modules/entity/includes/entity.controller.inc).

The error is not present if the version is 7.x.-2.1. No other changes have been done to the sites.

I asked our development vendor to take a look, here are their findings:
"1. search_api_acquia module which is calling
search_api_server_load_multiple()

2. search_api module which is calling
search_api_index_load_multiple()

the functions are getting called with wrong parameter types, while entity_load() the final function call in call trace expects the arguments to be array, #1 #2 are calling with boolean arguments as FALSE, since the core does not get affected by the wrong typed argument but the condition check throws a warning."

CommentFileSizeAuthor
#2 array_flip_warning-2865469-1_1.patch1.18 KBhesnvabr

Comments

hesnvabr created an issue. See original summary.

hesnvabr’s picture

Status: Active » Needs review
StatusFileSize
new1.18 KB

Hi,
I have added the patch for the issue. Please Review.

Status: Needs review » Needs work

The last submitted patch, 2: array_flip_warning-2865469-1_1.patch, failed testing.

arpitr’s picture

Status: Needs work » Needs review
drunken monkey’s picture

Status: Needs review » Postponed (maintainer needs more info)

First off: Version 2.3 of what? Search API doesn't have such a module version, nor does any related module I can think of at the moment.

Second: I don't know which Drupal version you're using, but as far as I know, the signature for entity_load() has always (OK, since #932016: DX: entity_load() defaults are useless (Beta 1)) looked like this:

function entity_load($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE) {

So, $ids is definitely allowed to be FALSE, it means "load all entities". Yes, NULL would make much, much more sense, and it's even that in Drupal 8, but in Drupal 7, it's like this.

hesnvabr’s picture

Title: Getting Warning: array_flip(): after update to version 2.3 » Getting Warning: array_flip(): after update search_api_acquia to version 7.x-2.3
Status: Postponed (maintainer needs more info) » Needs review

version 2.3 of search_api_acquia i.e 7.x-2.3.
And the drupal version is 7.52.

drunken monkey’s picture

Project: Search API » Acquia Search for Search API
Status: Needs review » Needs work

If it started to fail after an update to search_api_acquia, it seems more reasonable to report the bug there?
The analysis of your "development vendor" is rubbish, in any case.

drunken monkey’s picture

Version: 7.x-1.9 » 7.x-2.x-dev
Component: General code » Code
Status: Needs work » Active
hesnvabr’s picture

Project: Acquia Search for Search API » Search API
Version: 7.x-2.x-dev » 7.x-1.x-dev
Component: Code » General code
Status: Active » Closed (outdated)

This issue was already fixed in latest version.