Unable to add vbo fields to views - PHP 8 method_exists() error

Created on 4 May 2022, over 2 years ago
Updated 12 December 2023, 12 months ago

Problem/Motivation

Unable to add VBO fields to any views after upgrading to the latest version and upgrading my site to PHP 8. For example if I try to create a new view based on an entity or node type and try to add a vbo field I get this error:

TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in method_exists() (line 532 of /docroot/modules/contrib/views_bulk_operations/src/Plugin/views/field/ViewsBulkOperationsBulkForm.php)

Steps to reproduce

Proposed resolution

Patch line 532 of ViewsBulkOperationsBulkForm.php to something like:

From:
if (method_exists($action['class'], 'buildPreConfigurationForm')) {

To:
if (isset($action['class']) && method_exists($action['class'], 'buildPreConfigurationForm')) {

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: works as designed

Version

4.1

Component

Core

Created by

🇬🇧United Kingdom cashburton

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024