When I select more than one node and run arbitrary PHP script, I get this error:

An error has occurred.
Please continue to the error page

An error occurred. /batch?id=19&op=do

Then I click on the linked words error page and am taken to http://issuetracker/batch?id=19&op=finished.

Instead of ending up at /batch?id=19&op=do, I am redirected to /bulkoperations (the VBO view page) and see this in green text at the top:
An error occurred while processing _views_bulk_operations_batch_process with arguments: _views_bulk_operations_batch_process

If I go to admin/reports/dblog, I see no error details whatsoever.

I am merely executing node_save($object); per #28 at #195013: Recompute all instances of a computed field upon field change.

Comments

aren cambre’s picture

Title: "error occurred while processing" error with >1 node » "error occurred while processing" with >1 node

Whoops, the entry above is mistaken. I am not entering the PHP delimiters. I am just entering node_save($object); for the arbitrary PHP script.

Again, this works fine if I select only one node. It fails when selecting 2 or more.

aren cambre’s picture

More details. Implemented the script in #9 of the same issue in a page node:

$res = db_query("SELECT n.nid FROM {node} n WHERE n.type = 'some_content'");
while ($n = db_fetch_object($res)){
   $node = node_load($n->nid);
   $n = node_save($node);
}

Upon executing the page, I get this error:
Fatal error: Cannot redeclare fibonacci_conversion() (previously declared in /var/www/drupal/sites/issuetracker/modules/computed_field/computed_field.module(161) : eval()'d code:1) in /var/www/drupal/sites/issuetracker/modules/computed_field/computed_field.module(161) : eval()'d code on line 14

Yes, I do have my computed field instantiating a function.

VBO causes each node to execute in a shared namespace? Is this safe? Shouldn't node X's data be cleared before we start executing node Y? Otherwise we could have data residue from prior nodes that affects subsequent nodes.

aren cambre’s picture

I may have solved it by adding an if function_exists check before declaring the function in the computed code. But I still wonder about the broader implications of data residue not being cleared between processing each node.

aren cambre’s picture

Title: "error occurred while processing" with >1 node » Data residue/namespace not cleared between bulk node operations

Updating title.

infojunkie’s picture

Category: bug » support
Status: Active » Closed (won't fix)

IMO, the code in Computed Field isn't meant to contain function declarations. You can simply place that function in a new module and call it from the Computed Field script.

stkrzysiak’s picture

Component: Code » Core

Thanks for the info Aren, I was essentially doing the same thing as you and that is when I encountered this. I went with just creating a module(thanks for the tip kratib) since I will be using the function in multiple computed fields and can foresee this being a headache in the future!