if you add a comment without switching workflow state,
and you have locale module enabled,
on the /worklow page of the node you get:
"warning: preg_match() expects parameter 2 to be string, array given in Z:\home\test\www\includes\bootstrap.inc on line 771."
The problem is that workflow tries to wrap previous state name with t();
in workflow.pages.inc (56)
$old_state_name = check_plain(t($states[$history->old_sid]));
obviously, t('') returns array of all translations, and check_plain gets array instead of string.
if you replace the line above with the following code, the error is gone.
if (!empty($history->old_sid)) {
$old_state_name = check_plain(t($states[$history->old_sid]));
} else {
$old_state_name = '';
}
Comments
Comment #1
restyler commentedMay be the problem is deeper though, and it is incorrect that $history->old_sid is empty.
Comment #2
bobsinglar commentedI'm facing exactly the same problem.
Do you think it will be fixed on the next module release ?
thank you,
bob
Comment #3
samuelsov commentedHere is a slightly different patch that propose restyler.
In that case the old_sid should be the same as the actual sid so what i propose is :
But like restyler said, maybe we should have a value in old_sid instead...
Comment #4
janusman commentedDon't know if this will be attended since it's in 6.x-1.x, but here's a shot anyways =)
old_state can be empty if nodes were created before workflow.module was active and/or a workflow was assigned to that/those nodetype(s).
To me the problem is that t() is being called too many times, once upon populating $states:
and then below when trying to display it! (note the unnecessary use of check_plain())
Also the theme_workflow* functions also call t() and check_plain() =)
So, here's a patch for 6.x-1.x.
Comment #5
janusman commentedOops, wrong patch. Here's an updated one.
Comment #6
johnvI cannot reproduce this in D7, since it assigns a 'creation' state to the node as soon a you try to change it.
D6 version of Workflow is unmaintained, buut I'll keep this open for other users.
Comment #7
johnvI wish there was a nicer way to clear the issue queue from 'D6-issues that are fixed in D7' then a "won't fix for D6."