When I save nodes under workflow, I get the following error:

* warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in [removed]\sites\all\modules\workflow\workflow.module on line 275.
* warning: Illegal offset type in [removed]\sites\all\modules\workflow\workflow.module on line 1576.

Line 275 is starred:

function workflow_transition($node, $sid) {
  // Make sure new state is a valid choice.
*  if (array_key_exists($sid, workflow_field_choices($node))) {

Line 1576:

      $values['workflow-current-state-name']                =  $states[$sid];

These errors are showing up when I edit a node even if I don't move it to another state. I am the administrator on this site and I'm allowed to view and edit nodes in any state and to make all the available transitions, so it's not an access issue. Any ideas?

Running on Drupal 6.17, PHP 3.1.3.1, MySQL 5.0.51a, Windows.

Comments

beckyjohnson’s picture

I am also getting this error. Not really sure what is triggering it. Happy to help out if someone gives me a clue what to look for.

Becky

bnice5000’s picture

I am getting the same issue. However, If I uncheck all of the workflow permission fields from the workflow fields module the issue goes away. Could this possibly be related to the workflow fields module?

heatherann’s picture

bnice5000, can you explain what you mean by "If I uncheck all of the workflow permission fields from the workflow fields module"? Where are you doing this? Are you removing edit/view permissions from the various Workflow states for those fields? Or something else entirely?

nunoveloso’s picture

Title: Workflow state errors when saving node » Workflow state errors when saving node: array_key_exists() inworkflow_transition()
Version: 6.x-1.4 » 6.x-1.5

It's happening for me on 1.5 too (line 276).

Unsure what's proposed on #2 though.

Any thoughts?

nunoveloso’s picture

Title: Workflow state errors when saving node: array_key_exists() inworkflow_transition() » Workflow state errors when saving node: array_key_exists() in workflow_transition()

(fixing title)

johnv’s picture

Status: Active » Closed (duplicate)

This is also reported in D7: #2048327: array_key_exists() expects parameter 2 to be array, boolean given
And it is corrected in D7 here: #2037531-2: workflow_field_choices() has inconsistent result

If needed, request a backport over there.