Dear Views Entity View Friends:

I am now consistently getting the following warning message after building a "views field view" that contains a field from a contextual view. The error shows up after I flush the cache and goes away when I refresh the browser:

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: 57)
Drupal\node\Plugin\views\argument\Nid->titleQuery() (Line: 82)
Drupal\views\Plugin\views\argument\NumericArgument->title() (Line: 976)
Drupal\views\Plugin\views\argument\ArgumentPluginBase->getTitle() (Line: 1099)
Drupal\views\ViewExecutable->_buildArguments() (Line: 1254)
Drupal\views\ViewExecutable->build(NULL) (Line: 1378)
Drupal\views\ViewExecutable->execute() (Line: 263)
Drupal\views_field_view\Plugin\views\field\View->render(Object) (Line: 1144)
Drupal\views\Plugin\views\field\FieldPluginBase->advancedRender(Object) (Line: 224)
template_preprocess_views_view_field(Array, 'views_view_field', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render(Array, Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 1736)
Drupal\views\Plugin\views\field\FieldPluginBase->theme(Object) (Line: 765)
Drupal\views\Plugin\views\style\StylePluginBase->elementPreRenderRow(Array)
call_user_func(Array, Array) (Line: 376)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 713)
Drupal\views\Plugin\views\style\StylePluginBase->renderFields(Array) (Line: 580)
Drupal\views\Plugin\views\style\StylePluginBase->renderGrouping(Array, Array, 1) (Line: 467)
Drupal\views\Plugin\views\style\StylePluginBase->render(Array) (Line: 2117)
Drupal\views\Plugin\views\display\DisplayPluginBase->render() (Line: 1520)
Drupal\views\ViewExecutable->render() (Line: 171)
Drupal\views\Plugin\views\display\Page->execute() (Line: 1617)
Drupal\views\ViewExecutable->executeDisplay('purchase_contracts', Array) (Line: 78)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func(Array, Array) (Line: 376)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 149)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

frmcclurg created an issue. See original summary.

Znak’s picture

I couldn't reproduce your error. Write where you building a "views field view"

jibran’s picture

Version: 8.x-1.0-beta2 » 8.x-1.x-dev
Status: Active » Postponed (maintainer needs more info)

Can you please share the sample parent and child view?

crasx’s picture

This happened to me because my view was using {{ fields.nid }} instead of {{ raw_fields.nid }}. This caused a markup object to be passed as an argument to the child view instead of a string

jessicakoh’s picture

to reproduce this error:

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /Users/abc/sites/includes/entity.inc).

1. Update Media and File_Entity

2. Go to appearance, upload a custom logo.

steveoriol’s picture

Thank you crasx (#4), Your tip my help ;-)

aaronglamb’s picture

I second the thanks to #4 FTW. Cheers.

nghai’s picture

Confirmed, #4 fixed the issue.

Romixua’s picture

Thank You @crasx (#4), your decision fixed this issue.

trangunghoa’s picture

Thank You @crasx (#4), you saved my time.

Pancho’s picture

Issue tags: +array_flip()
matt_zimo’s picture

Thank you @crasx!

usmanjutt84’s picture

#4 works for me.

jwineichen’s picture

Just to clarify, does this mean this is a documentation issue and we should always just use the raw nid or is this a bug that needs to be fixed?

revati_gawas’s picture

Issue tags: -

Thanks @crasx! It helps to fixed my issue.

boby_ui’s picture

this is strange, once I used raws, the site broke into error :

like placeholder without trailing

Abhijith S’s picture

#4 fixed my issue. Thankyou @crasx.

SAVEL’s picture

#4 must fix the issue, but I'm getting an error for the multivalued argument and the view is broken.

InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (line 744 of /var/www/html/core/lib/Drupal/Core/Database/Connection.php).

SAVEL’s picture

Status: Postponed (maintainer needs more info) » Active

Don't we have enough information to proceed?

By the way error from #18 is related to https://www.drupal.org/project/views_field_view/issues/2873359
It offers a patch but solves the problem not in an elegant way (regexp).

SAVEL’s picture

Status: Active » Needs review

Adding an explicit conversion to string solves the problem.

Please review.

andileco’s picture

@SAVEL - your patch (mr!3) fixed the issue for me, as well as a related issue, which output:

Warning: Illegal offset type in Drupal\Core\Entity\EntityStorageBase->load() (line 297 of /code/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php)

  • dawehner committed 1ec741a on 8.x-1.x authored by SAVEL
    Issue #2844248 Fix a warning array_flip() for arguments
    
dawehner’s picture

Status: Needs review » Fixed

Thank you @savel for the patch and @andileco for the testing.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.