Entity selection works improperly if the view gives random set results

Created on 18 July 2019, over 5 years ago
Updated 11 March 2025, 26 days ago

Problem/Motivation

Seems like VBO gets a list of selected entities in strange way. If the view returns different set of results on each execution, you can notice that other entities are affected but not always those you've selected.

Clean way to reproduce:

  1. Install Drupal, install VBO
  2. Create some content (I've generated it using devel module, but it does not matter)
  3. Create the view with VBO which displays the content
  4. Enable VBO actions with confirmation screen (I was tested on Change the author of content)
  5. Set view sorting order to Random
  6. Disable views cache
  7. Open the view, refresh the page several times to ensure that view produces random results
  8. Select some rows, try to execute action
  9. On confirmation screen you will see the list of some different entities which can also include those you've selected (but it seems random)

This is a problem because if data on your website is being updated dynamically (a lot of users generate a lot of content) even non-random sorted view can produce different result set on each execution. So when managing content using VBO it's possible to make a mistake which does not depend on user who tries to manage content.

Proposed resolution

Replace numeric row index with bulk_form_key which represents actual entity.

Remaining tasks

Review needed.

πŸ› Bug report
Status

Needs work

Version

3.0

Component

Core

Created by

πŸ‡ΊπŸ‡¦Ukraine mpolishchuck

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.

Production build 0.71.5 2024