Upgraded from 8.x-1.4 to 8.x-2.0-alpha4. Needed to use Patch in #7

After upgrade getting these 2 warnings in watchdog, referenced view does display correctly.

Warning: array_filter() expects parameter 1 to be array, null given in Drupal\viewsreference\Plugin\Field\FieldFormatter\ViewsReferenceFieldFormatter->viewElements() (line 90 of /app/web/modules/contrib/viewsreference/src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php)
and
Warning: Invalid argument supplied for foreach() in viewsreference_views_pre_build() (line 71 of /app/web/modules/contrib/viewsreference/viewsreference.module)

Reason is $this->getFieldSetting('enabled_settings') is returning NULL for me.

Attached the row from the paragraph table before and after the update.

Comments

Spokje created an issue. See original summary.

spokje’s picture

StatusFileSize
new1.18 KB

Attached patch remove the Warnings for me.

spokje’s picture

Assigned: spokje » Unassigned
Status: Active » Needs review
andy-blum’s picture

This works for that file, but there's another spot that's also broken, line 146 of src/Plugin/Field/FieldWidget/ViewsReferenceTrait.php. It's the same array_filter() on NULL issue, combined with an invalid arg for the following foreach

andy-blum’s picture

StatusFileSize
new1.88 KB

Patch that should address #4 as well
Didn't save right. See #6

andy-blum’s picture

StatusFileSize
new2.25 KB

New to the patch-making game, but it seems like d.o is stripping out the redundant parts of my patch? Use in combination with #2.

spokje’s picture

StatusFileSize
new2.12 KB

@ablum d.o. doesn't strip out redundant parts, so there must be some other "funky" stuff going on there.
I'm pretty certain you saw: https://www.drupal.org/project/viewsreference/git-instructions on a (very) quick guide to patch-making?

Anyway: Here's a patch that combines #2 and #6.
I've also hidden the patches from the previous comments (just uncheck the display checkbox to the right of each one) to prevent loads of files confusing people on the top of this issue.

andy-blum’s picture

Thanks, @spokje, that patch worked perfectly. +1 for RTBC

seanb’s picture

StatusFileSize
new1.84 KB
new1.88 KB

I think since PHP 7 is now a requirement for Drupal 8 we can make this a bit shorter. Could you check if the attached patch work as expected and RTBC if it does?

spokje’s picture

Status: Needs review » Reviewed & tested by the community

Replaced patch #7 with #9, put it on a production site, still no errors => RTBC.

nicolash’s picture

StatusFileSize
new1.89 KB

Wasn't applying for me anymore, but approach works.

  • seanB committed 82551ed on 8.x-2.x
    Issue #3061262 by Spokje, andy-blum, seanB, NicolasH: Warnings after...
seanb’s picture

Status: Reviewed & tested by the community » Fixed

Fixed! Will roll a new release today.

Status: Fixed » Closed (fixed)

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