Illegal string offset 'action_id' in ViewsBulkOperationsBulkForm

Created on 21 June 2021, over 3 years ago
Updated 27 August 2024, 3 months ago

Problem/Motivation

Received a warning:

Warning: Illegal string offset 'action_id' in Drupal\views_bulk_operations\Plugin\views\field\ViewsBulkOperationsBulkForm->getBulkOptions() (line 848 of modules/contrib/views_bulk_operations/src/Plugin/views/field/ViewsBulkOperationsBulkForm.php).

Steps to reproduce

Proposed resolution

To replace

if (!isset($this->actions[$selected_action_data['action_id']])) {

with the following

if (!isset($selected_action_data['action_id']) || !isset($this->actions[$selected_action_data['action_id']])) {

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs review

Version

4.0

Component

Core

Created by

🇧🇬Bulgaria vuil Bulgaria 🇧🇬 🇪🇺 🌍

Live updates comments and jobs are added and updated live.
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.

  • 🇧🇷Brazil viniciusrp

    I am facing this error with Data Policy Export module from Data Policy module.

    The Data Policy Export create a Action, it's defined by the annotitation below:

     * @Action(
     *   id = "data_policy_export_data_policy_action",
     *   label = @Translation("Export the selected data policies to CSV"),
     *   type = "user_consent",
     *   confirm = FALSE
     * )
    

    So when I go to a list where that Action is available, the error happen.

    The patch from #2 comment isn't working as expect, because they remove the Action from list and I need the Action available.

    My how to reproduce:
    - Install Data Policy
    - Enable Data Policy and Data Policy Export modules
    - Try to access the Data Policy Agreements report (/admin/reports/data-policy-agreements?data-policy-revision)

    I am attaching a patch where I fixed and is working for my case

  • 🇧🇷Brazil viniciusrp

    A new patch with more fixes

  • 🇳🇱Netherlands robertragas

    @viniciusrp I believe in the case for the data_policy module the issue lies in how the action gets attached to the view itself. Because re-attaching the VBO action to the view also solves the issue which indicated a broken config for the view as Graber states.

Production build 0.71.5 2024