After clear cache, a warning is coming :

Warning: Illegal string offset 'name' in token_asort_tokens() (line 577 of project/modules/contrib/token/token.module).

Patch (need to be reviewed):
line 577

/**
 * uasort() callback to sort tokens by the 'name' property.
 */
function token_asort_tokens($token_a, $token_b) {
  if(is_array($token_a) && is_array($token_b) ) {
    if(array_key_exists('name',$token_a) && array_key_exists('name',$token_b)) {
      return strnatcmp($token_a['name'], $token_b['name']);
    }
  }
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sugandhkhanna2 created an issue. See original summary.

gemalm’s picture

Version: 7.x-1.6 » 7.x-1.7
FileSize
559 bytes

Hi,
I tested the code and the warning is gone so I created the patch. I got the same warning in 7.x-1.6 and 7.x-1.7

Dave Reid’s picture

Status: Patch (to be ported) » Needs review
Dave Reid’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: -#D7AX

I would say this is an issue with whatever tokens are not setting the 'name' array key, I'm not sure this is something we should hide when something else is going wrong.