Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm getting random warning notices throughout the admin section of Drupal with the following errors.
Warning: strnatcmp() expects parameter 2 to be string, array given in token_asort_tokens() (line 463 of /srv/clients/exampe/code/sites/all/modules/contrib/token/token.module). Backtrace:
strnatcmp('Site information', Array) token.module:463
token_asort_tokens(Array, Array)
uasort(Array, 'token_asort_tokens') token.module:429
token_get_info() token.module:476
token_get_global_token_types() token.module:508
token_get_invalid_tokens_by_context(Array, Array) token.module:620
token_element_validate(Array, Array) form.inc:1830
form_builder('pathauto_patterns_form', Array, Array) form.inc:1822
form_builder('pathauto_patterns_form', Array, Array) form.inc:1822
form_builder('pathauto_patterns_form', Array, Array) form.inc:831
drupal_process_form('pathauto_patterns_form', Array, Array) form.inc:366
drupal_build_form('pathauto_patterns_form', Array) form.inc:123
drupal_get_form('pathauto_patterns_form')
call_user_func_array('drupal_get_form', Array) menu.inc:517
menu_execute_active_handler() index.php:21
Warning: strnatcmp() expects parameter 2 to be string, array given in token_asort_tokens() (line 463 of /srv/clients/example/code/sites/all/modules/contrib/token/token.module). Backtrace:
strnatcmp('Users', Array) token.module:463
token_asort_tokens(Array, Array)
uasort(Array, 'token_asort_tokens') token.module:429
token_get_info() token.module:476
token_get_global_token_types() token.module:508
token_get_invalid_tokens_by_context(Array, Array) token.module:620
token_element_validate(Array, Array) form.inc:1830
form_builder('pathauto_patterns_form', Array, Array) form.inc:1822
form_builder('pathauto_patterns_form', Array, Array) form.inc:1822
form_builder('pathauto_patterns_form', Array, Array) form.inc:831
drupal_process_form('pathauto_patterns_form', Array, Array) form.inc:366
drupal_build_form('pathauto_patterns_form', Array) form.inc:123
drupal_get_form('pathauto_patterns_form')
call_user_func_array('drupal_get_form', Array) menu.inc:517
menu_execute_active_handler() index.php:21
Warning: strnatcmp() expects parameter 1 to be string, array given in token_asort_tokens() (line 463 of /srv/clients/example/code/sites/all/modules/contrib/token/token.module). Backtrace:
strnatcmp(Array, 'Vocabularies') token.module:463
token_asort_tokens(Array, Array)
uasort(Array, 'token_asort_tokens') token.module:429
token_get_info() token.module:476
token_get_global_token_types() token.module:508
token_get_invalid_tokens_by_context(Array, Array) token.module:620
token_element_validate(Array, Array) form.inc:1830
form_builder('pathauto_patterns_form', Array, Array) form.inc:1822
form_builder('pathauto_patterns_form', Array, Array) form.inc:1822
form_builder('pathauto_patterns_form', Array, Array) form.inc:831
drupal_process_form('pathauto_patterns_form', Array, Array) form.inc:366
drupal_build_form('pathauto_patterns_form', Array) form.inc:123
drupal_get_form('pathauto_patterns_form')
call_user_func_array('drupal_get_form', Array) menu.inc:517
menu_execute_active_handler() index.php:21
Warning: strnatcmp() expects parameter 2 to be string, array given in token_asort_tokens() (line 463 of /srv/clients/example/code/sites/all/modules/contrib/token/token.module). Backtrace:
strnatcmp('View', Array) token.module:463
token_asort_tokens(Array, Array)
uasort(Array, 'token_asort_tokens') token.module:429
token_get_info() token.module:476
token_get_global_token_types() token.module:508
token_get_invalid_tokens_by_context(Array, Array) token.module:620
token_element_validate(Array, Array) form.inc:1830
form_builder('pathauto_patterns_form', Array, Array) form.inc:1822
form_builder('pathauto_patterns_form', Array, Array) form.inc:1822
form_builder('pathauto_patterns_form', Array, Array) form.inc:831
drupal_process_form('pathauto_patterns_form', Array, Array) form.inc:366
drupal_build_form('pathauto_patterns_form', Array) form.inc:123
drupal_get_form('pathauto_patterns_form')
call_user_func_array('drupal_get_form', Array) menu.inc:517
menu_execute_active_handler() index.php:21
Warning: uasort(): Array was modified by the user comparison function in token_get_info() (line 429 of /srv/clients/example/code/sites/all/modules/contrib/token/token.module). Backtrace:
uasort(Array, 'token_asort_tokens') token.module:429
token_get_info() token.module:476
token_get_global_token_types() token.module:508
token_get_invalid_tokens_by_context(Array, Array) token.module:620
token_element_validate(Array, Array) form.inc:1830
form_builder('pathauto_patterns_form', Array, Array) form.inc:1822
form_builder('pathauto_patterns_form', Array, Array) form.inc:1822
form_builder('pathauto_patterns_form', Array, Array) form.inc:831
drupal_process_form('pathauto_patterns_form', Array, Array) form.inc:366
drupal_build_form('pathauto_patterns_form', Array) form.inc:123
drupal_get_form('pathauto_patterns_form')
call_user_func_array('drupal_get_form', Array) menu.inc:517
menu_execute_active_handler() index.php:21
I have been trying to trace the dependencies of what modules may be providing the wrote parameter type and why. What additional information would help with identifying a pattern to this error?
Comments
Comment #0.0
emptyvoid CreditAttribution: emptyvoid commentedremoving client specific information.
Comment #1
Dave ReidCheck your status report page (admin/reports/status). It means you some kind of conflict where two modules are trying to provide the same token.
Comment #2
emptyvoid CreditAttribution: emptyvoid commentedHmm,
I will continue to investigate, the current breadcrumbs I can find are the pages where the warning errors appear the most often.
http://example.com/admin/config/search/path/patterns
http://example.com/admin/commerce/products/types/commerce-tshirt
http://example.com/admin/commerce/products/types/product/fields/field_image
http://example.com/admin/commerce/products/types/add
My first hunch is either Drupal Commerce or a sub-contrib module. I could also do a search through my contrib modules for hooks registering for tokens. However I got 989 matches.. so that isn't specific enough.
Is there a specific function or class in the token module I could debug (using xdebug) and step through to know when and where within the page execution stack this occurs?
I'd like to find the conflict then notify the correct module maintainers.
Thanks,
Comment #3
Dave ReidThe token module should be able to at least warn you on admin/reports/status which tokens are at fault and are causing the problem.
Comment #4
emptyvoid CreditAttribution: emptyvoid commentedHonestly I think is because I have a lot of modules enabled that provide hooks to add token keys on page load.. At some point it just gives up and pukes out errors.. It seems to be better now, perhaps it's tummy isn't upset any longer?
It still occurs but is less frequent, maybe is it acid reflux. I hear that's treatable. :P
If I happen to track down what module is causing the problem we can squash this whole lactose intolerant issue once and for all!
Comment #5
Dave ReidYou're giving me heartburn ignoring my instructions twice on how to help you figure out what is responsible for the errors.
Comment #7
KartagisHi,
I've got the same issue, and /admin/reports/status doesn't tell me anything about conflicting tokens only gives the message
Warning: strnatcmp() expects parameter 1 to be string, array given in token_asort_tokens() (line 569 of /var/www/clients/client4/web4/web/sites/all/modules/token/token.module).
In my case, I have PHPmailer module installed. How can I debug it?Regards,
K.
Comment #7.0
Kartagisadding php tag for color coding.
Comment #8
kenorb CreditAttribution: kenorb commentedI had similar warning on cron run, after 2nd time it disappeared.
Code:
Comment #9
deanflory CreditAttribution: deanflory commentedI just got these, now to figure out which modules are responsible:
Comment #10
Collins405 CreditAttribution: Collins405 commented@deanflory How did you get that report?
Comment #11
deanflory CreditAttribution: deanflory commentedRun cron, see results in the Status Report like #9 when there is a Token conflict.
FYI, in my case, this turned out to be an issue with the Metatag module having some duplication going on in a dev release from a few weeks ago.
Updating to the latest "rc1" version of Metatag fixed my issue completely. Here's my issue in the Metatag queue: #2305433: Token types are defined by multiple modules: $info['tokens']['metatag']['fb:admins'] $info['tokens']['metatag']['fb:app_id']
Comment #12
Collins405 CreditAttribution: Collins405 commentedThanks for getting back to me, however I guess Im not seeing the same problems, as this error was happening before I installed the Metatag module. Infact, even when disabling all contrib modules apart from token, the errors are still happening, and considering I haven't edited any core files, or hacked any token files, Im at a bit of a loss, because in a fresh install with just token, there are no problems.
Something is causing this though!
Comment #13
deanflory CreditAttribution: deanflory commentedA google search of your error(s) didn't bring up much more than this:
https://www.drupal.org/node/1888880
Comment #14
peterx CreditAttribution: peterx commentedLatest software. I get the error when saving admin/people page:
Warning: strnatcmp() expects parameter 1 to be string, array given in token_asort_tokens() (line 569 of token/token.module).
Warning: strnatcmp() expects parameter 1 to be string, array given in token_asort_tokens() (line 569 of token/token.module).
Warning: strnatcmp() expects parameter 1 to be string, array given in token_asort_tokens() (line 569 of token/token.module).
Warning: strnatcmp() expects parameter 1 to be string, array given in token_asort_tokens() (line 569 of token/token.module).
Warning: strnatcmp() expects parameter 1 to be string, array given in token_asort_tokens() (line 569 of token/token.module).
Warning: uasort(): Array was modified by the user comparison function in token_get_info() (line 529 of token/token.module).
a: a:2:{s:4:"name";s:12:"Short format";s:11:"description";s:73:"A date in 'short' format. (2014-10-03 17:57)";}
b: a:2:{s:4:"name";s:13:"Raw timestamp";s:11:"description";s:73:"A date in UNIX timestamp format (1412323056)";}
a: a:2:{s:4:"name";s:13:"Raw timestamp";s:11:"description";s:73:"A date in UNIX timestamp format (1412323056)";}
b: a:2:{s:4:"name";s:10:"Time-since";s:11:"description";s:79:"A date in 'time-since' format. (44 years 9 months)";}
a: a:2:{s:4:"name";s:10:"Time-since";s:11:"description";s:79:"A date in 'time-since' format. (44 years 9 months)";}
b: a:2:{s:4:"name";s:12:"Short format";s:11:"description";s:73:"A date in 'short' format. (2014-10-03 17:57)";}
That short date string is in system_tokens.inc.