Skip to content

Conversation

idflood
Copy link

@idflood idflood commented Jun 29, 2018

On a view with multiple selective filters I had this warning showing up (only for anonymous users):

Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 227 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).

Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 212)
Drupal\Core\Entity\EntityStorageBase->load() (Line: 461)
Drupal\views_selective_filters\Plugin\views\filter\Selective->getOids() (Line: 86)

It appears that the $key was sometimes false.

foreach ((array) $keys as $key) {
$value = NULL;

if (NULL !== $entityTypeStorage) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add the $key empty check to the condition above?

@idflood
Copy link
Author

idflood commented Jul 18, 2018

@joelpittet good point, I moved the $key condition above as you suggested.

@bmcclure
Copy link
Owner

Thanks for this PR! I will test out the change and get it merged ASAP.

@jvandenrym
Copy link

I get this warning. Will any of the above fix this warning. Tried the above but to no avail.

Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 264 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 249)
Drupal\Core\Entity\EntityStorageBase->load() (Line: 460)
Drupal\views_selective_filters\Plugin\views\filter\Selective->getOids() (Line: 86)
Drupal\views_selective_filters\Plugin\views\filter\Selective->getValueOptions() (Line: 114)
Drupal\views_selective_filters\Plugin\views\filter\Selective->valueForm(Array, Object) (Line: 861)
Drupal\views\Plugin\views\filter\FilterPluginBase->buildExposedForm(Array, Object) (Line: 96)`
...
   ...

@idflood
Copy link
Author

idflood commented Oct 31, 2018

@jvandenrym yes it should be fixed on this is merged, at least your error message seems to be exactly what I had before.

@KaseyMK
Copy link

KaseyMK commented Feb 6, 2020

This change fixes the array_flip error on my use-case, too. Can it be merged? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants