the Token module has been spewing these errors lately.
strnatcmp() expects parameter 2 to be string, array given in token.module at line 464 in token_asort_tokens()
I finally got a chance to look into this, and it looks like workflow's sending malformed tokens over to the Token module. Here's an example of a good one and one that Workflow sends.
Good one:
array (
'name' => 'Private message',
'description' => 'Tokens related to private messages.',
'needs-data' => 'privatemsg_message',
'type' => 'privatemsg_message',
)
From workflow:
array (
'name' =>
array (
0 => 'Nodes',
1 => 'Workflows',
),
'description' =>
array (
0 => 'Tokens related to individual content items, or "nodes".',
1 => 'Tokens related to workflows.',
),
'needs-data' =>
array (
0 => 'node',
1 => 'node',
),
'type' => 'node',
)
Now that I know what's causing the error, I'll go cook up a patch for this.
Comments
Comment #1
Ogredude commentedI can't figure out where this malformed array is coming from.
workflow_token_info() is absolutely correct.
I got the error to go away for a bit by doing
drush ev "token_clear_cache();"but the issue returned a very short time later.
Comment #2
Ogredude commentedComment #3
Anonymous (not verified) commentedI'm also getting this on a multilingual site:
Shouldn't
workflow_token_info()return a non-nested $type? #735354: User token types should *not* be nested.Comment #4
Anonymous (not verified) commentedBut if I change
array('node' => $type)to$typeit triggers a warning on the status report page:Comment #5
Ogredude commentedI think I found the source of the issue. Workflow was putting its tokens into the 'node' namespace. Changed it to put them in the 'workflow' namespace instead.
Comment #6
Anonymous (not verified) commentedThanks for making a patch, I don't have git on my sytem.
FYI, I also had to change
workflow_tokens()and include square brackets in the array indices, otherwise I got an extra bracket around my replacements:Comment #7
Bastlynn commented@Ogredude - patch looks good, I've pulled it over into the dev branch. Thanks for the contrib :)
@Edith - I'm not sure that's a solution that will work on the module. I'm very curious how the double-brackets are getting introduced to your system. I don't think that's coming from workflow, especially since it's just those two values you're seeing it for. I think that needs a closer look in wherever you're calling the token from, perhaps the calling system is passing in [[workflow-current-state-name]] which is how the double bracket is getting in there? It also looks like your code is changing the token names by adding workflow: to the front of each name.