1. Create 2 nodes
  2. Create a VBO View that lists the 2 nodes and allows for an action (ie: Execute arbitrary PHP)
  3. Visit the View, select the 2 nodes, but don't actually submit anything
  4. Go to Admin > Manage Content and delete one of the 2 nodes
  5. Vist the View again. Submit the action on the single remaining node

Expected: You selected the following 1 item:
Actual: You selected the following 2 items:

If you dig into the action form, you'll find that $context['selection'] actually contains 2 items in it, not one. This will persist until $_SESSION['vbo_values'] is cleared (which happens when action is actually submitted, or when you logout).

This is actually a much simpler test case than the situation that occurred that actually brought the problem to my attention. In my case, I had a View base table other than node, and one of the fields within had a relationship to node. I also had node revisions turned on. As a result, $context['selection'] would contain a 'node_myNodeModule_vid' property. Any time a user selected some items in the VBO View, didn't submit action, and then went and made a new node revision, an invalid selection would persist in the session, and the same problem described above would result.

I'm not sure what the proper fix for this is. Either an intelligent way to clear out $_SESSION['vbo_values'], or a way to validate the values stored within it. The latter might be difficulr - especially if we're dealing with very large datasets...

Comments

bojanz’s picture

Status: Active » Closed (works as designed)

Unfortunately, just like you, I don't see a way out of that.

Expected: You selected the following 1 item:
Actual: You selected the following 2 items:

This shouldn't be a problem, if VBO tries to delete a node that's already gone, it should just pass it, and all is well. Does that not work that way in 6.x-1.x right now?

But for the vid problem, I don't see any other option than disabling the "preserve selection" option.
That option is a minefield, which is why I haven't implemented it in the D7 branch.

roseba’s picture

Why is that option a minefield?

We see this problem in D6. It isn't consistently triggered. Often it happens when we select boxes quickly.