I'm using Workflow Node, and am always cautious about updating Workflow, so I chose to update it from 7.x-2.5 to 7.x-2.6 in an otherwise fully up-to-date development environment, using drush 7.1.0, running under PHP 5.5.30. 'drush status' indicated that everything was good prior to attempting the update. I cleared Drupal's caches prior to running the update.

The update appeared to run successfully, including running database updates 7016 and 7017, but then drush was unable to clear Drupal 7.41's caches, and Drupal was no longer able to complete its bootstrap sequence, due to this error:
PHP Fatal error: require_once(): Failed opening required '/**removed**/sites/all/modules/workflow/includes/Entity/WorkflowTransitionController.php'

Here's the full transcript with some unneeded information removed:

$ drush up workflow
Update information last refreshed: 21 November 2015 - 2:40pm
 Name                     Installed Version  Proposed version  Message          
 Workflow API (workflow)  7.x-2.5            7.x-2.6           Update available 


Code updates will be made to the following projects: Workflow [workflow-7.x-2.6]

Note: A backup of your project will be stored to backups directory if it is not managed by a supported version control system.
Note: If you have made any modifications to any file that belongs to one of these projects, you will have to migrate those modifications after updating.
Do you really want to continue with the update process? (y/n): y
Project workflow was updated successfully. Installed version is now 7.x-2.6.
Backups were saved into the directory /**removed**/drush-backups/**removed**/20151121144009/modules/workflow.               [ok]
 Workflow  7016  Add an index to {workflow_node_history}.nid.           
 Workflow  7017  Add a primary key to {workflow_scheduled_transition}.
Do you wish to run all pending updates? (y/n): y
Performed update: workflow_update_7016                                                                                   [ok]
Added stid primary key to {workflow_scheduled_transition}                                                                [ok]
Performed update: workflow_update_7017                                                                                   [ok]
require_once(/**removed**/sites/**removed**/sites/all/modules/workflow/includes/Entity/WorkflowTransitionController.php):[warning]
failed to open stream: No such file or directory bootstrap.inc:3211
Drush command terminated abnormally due to an unrecoverable error.                                                       [error]
Error: require_once(): Failed opening required
'/**removed**/sites/**removed**/sites/all/modules/workflow/includes/Entity/WorkflowTransitionController.php'
(include_path='.:/usr/local/share/pear') in /**removed**/sites/**removed**/includes/bootstrap.inc, line 3211
PHP Fatal error:  require_once(): Failed opening required '/**removed**/sites/**removed**/sites/all/modules/workflow/includes/Entity/WorkflowTransitionController.php' (include_path='.:/usr/local/share/pear') in /**removed**/sites/**removed**/includes/bootstrap.inc on line 3211
The external command could not be executed due to an application error.                                                  [error]
Finished performing updates.                                                                                             [ok]

Subsequent attempts to manually clear Drupal's caches failed, with the same 'require once()' failure to open workflow/includes/Entity/WorkflowTransitionController.php which is not present in Workflow 7.x-2.6, but was in Workflow 7.x-2.5.

Drupal failed to bootstrap after this, yielding http 500 errors in Apache 2.4.

It appears that the entire set of Entity support files have been rewritten between the two versions of Workflow.

My solution was to temporarily drop a copy of 'WorkflowTransitionController.php' taken from 7.x-2.5 into Workflow 7.x-2.6's 'includes/Entity' directory, in order to satisfy Drupal's 'require once()' requirement, then I was able to run 'drush cc all', and after clearing the caches I was then able to remove 'WorkflowTransitionController.php' and everything appears to be working properly.

I'm not familiar with the intricacies of Drupal's bootstrap procedure, but it seems that the Workflow update left it stuck in a strange situation where it couldn't bootstrap in order to clear its cache, and clearing its cache was all that was required to enable it to bootstrap again. The new version of Workflow appears to be functioning properly, so it seems that some omission in Workflow's update procedures probably caused my problem.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

activelink created an issue. See original summary.

activelink’s picture

Component: Workflow Node API » Miscellaneous
johnv’s picture

Indeed. The file workflow/includes/Entity/WorkflowTransitionController.php is removed.
I assume this is not supported. I will re-add an empty file to the next version.

  • johnv committed fd654bc on 7.x-2.x
    Issue #2620530: Re-add file WorkflowTransitionController.php to avoid...
johnv’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

johnv’s picture

A 2.7 release is now created to avoid this core error.

NancyDru’s picture

Status: Closed (fixed) » Active

Sorry, but I got this going from 2.5 to 2.7, so the new release did not fix it. I got around it by using the empty interface technique.

johnv’s picture

Title: Upgrading from 7.x-2.5 to 7.x-2.6 with drush breaks Drupal 7.41 » Fatal errors when upgrading from 7.x-2.5 to 7.x-2.6/2.7 with drush

From #2631844-8: Fatal Errors on Update using drush describing the 'empty interface technique':

This same issue also happens in Drupal multisites. The first site where the update is done is ok done manually, the succeeding sites cannot even login:

The temp fix is to insert :

interface WorkflowInterface
{
}

before:

class Workflow extends Entity implements WorkflowInterface {
public $wid = 0;
public $name = '';
...
johnv’s picture

  • johnv committed 59f0463 on 7.x-2.x
    Issue #2620530: Include WorkflowInterface.php to avoid fatal errors when...

  • johnv committed aaec6c3 on 7.x-2.x
    Issue #2620530: Include WorkflowInterface.php to avoid fatal errors when...
johnv’s picture

Above commit adds include_once('WorkflowInterface.php'); to Workflow.php, as suggested by user activelink in #2638438: Upgrading from 7.x-2.6 to 7.x-2.7 with drush breaks Drupal 7.41 .

johnv’s picture

Version: 7.x-2.6 » 7.x-2.7
Status: Active » Needs review

Setting this to NR, only to keep it open, for new drush upgrades.

NancyDru’s picture

I didn't Drush, but the update 2.5 to 2.8 on my stage site was smooth.

johnv’s picture

That is good news, but i am afraid the error only appears when drushing..

johnv’s picture

Happy new year!!

activelink’s picture

This is a response to your request in https://www.drupal.org/node/2638438#comment-10710444 - I guess that this is the 'other issue'?

I wasn't able to take my development site back to workflow 7.x-2.5, as the upgrade to 7.x-2.6 had made changes to the database, but I successfully ran the update from 7.x-2.7 to 7.x-2.8 with drush with no errors. I then manually removed workflow 7.x-2.8, replaced it with workflow 7.x-2.6, cleared caches, verified that my development site was working correctly, and ran "drush up workflow", and drush updated my development site back to workflow 7.x-2.8 without a hitch, so I can report that:

  1. drush can update workflow 7.x-2.6 directly to 7.x-2.8 successfully, with no errors
  2. drush can also update workflow 7.x-2.7 to 7.x-2.8 successfully, with no errors

You also asked about how I cleared cache when I used drush to update... "drush up" always clears all caches as the final step of an update, so this does not normally need to be performed manually. You can see the entire process in the transcripts that I posted. The only item not shown in those is that I ran "drush cc all" prior to running the problematic updates, as I always do before I make updates. For consistency, I did the same before running the two tests that you requested above, to ensure a worst-case scenario that was most likely to break, if my assumptions about how core clears all caches are correct.

I hope this helps, and thanks for all your work on workflow (unintended pun impossible to avoid!) - Happy New Year!

Mac_Weber’s picture

Status: Needs review » Needs work

I just got this error running drush updb to update from 2.5 to 2.8 using drush.

Output in first run:

% drush updb
 Workflow  7017  Add a primary key to {workflow_scheduled_transition}.
Do you wish to run all pending updates? (y/n): y
SQLSTATE[42000]: Syntax error or access violation: 1068 Multiple primary key defined                                                              [error]
Performed update: workflow_update_7017                                                                                                            [ok]
'all' cache was cleared.                                                                                                                          [success]
The  role has been reset for all permissions.                                                                                                     [status]
Finished performing updates.                                                                                                                      [ok]

Second run:

% drush updb
 Workflow  7017  Add a primary key to {workflow_scheduled_transition}.
Do you wish to run all pending updates? (y/n): y
SQLSTATE[42000]: Syntax error or access violation: 1068 Multiple primary key defined                                                              [error]
Performed update: workflow_update_7017                                                                                                            [ok]
Invalid argument supplied for foreach() common.inc:7176                                                                                           [warning]
array_keys() expects parameter 1 to be array, null given common.inc:7196                                                                          [warning]
Invalid argument supplied for foreach() common.inc:7176                                                                                           [warning]
array_keys() expects parameter 1 to be array, null given common.inc:7196                                                                          [warning]
Invalid argument supplied for foreach() common.inc:7176                                                                                           [warning]
array_keys() expects parameter 1 to be array, null given common.inc:7196                                                                          [warning]
Invalid argument supplied for foreach() common.inc:7176                                                                                           [warning]
array_keys() expects parameter 1 to be array, null given common.inc:7196                                                                          [warning]
Invalid argument supplied for foreach() common.inc:7176                                                                                           [warning]
array_keys() expects parameter 1 to be array, null given common.inc:7196                                                                          [warning]
Invalid argument supplied for foreach() entity.info.inc:151                                                                                       [warning]
Invalid argument supplied for foreach() entity.info.inc:151                                                                                       [warning]
Invalid argument supplied for foreach() entity.info.inc:151                                                                                       [warning]
Invalid argument supplied for foreach() entity.info.inc:151                                                                                       [warning]
Invalid argument supplied for foreach() entity.info.inc:151                                                                                       [warning]
Argument 2 passed to entity_views_field_definition() must be of the type array, null given, called in                                             [error]
/drupal_root/sites/all/modules/entity/views/entity.views.inc on line 152 and defined entity.views.inc:175
E_RECOVERABLE_ERROR encountered; aborting. To ignore recoverable errors, run again with --no-halt-on-error                                        [error]
Drush command terminated abnormally due to an unrecoverable error.                                                                                [error]
The external command could not be executed due to an application error.                                                                           [error]
Finished performing updates.                                                                                                                      [ok]
Mac_Weber’s picture

Status: Needs work » Needs review
FileSize
1.21 KB

This patch drops the primary key before adding a new one: https://api.drupal.org/comment/45893#comment-45893

It also fixes the coding standards in this method.

  • johnv committed bd1b42e on 7.x-2.x authored by Mac_Weber
    Issue #2620530 by Mac_Weber: Fatal errors when upgrading from 7.x-2.5 to...
johnv’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.