There is an undefined index that happens on a handful of URLs on our site. When it happens it happens typically five times or so on that specific page load. I can't readily provide tools to reproduce it, but I am suggesting a way to check for expected indexes which may not exist (for some reason)

It could actually be added for each, I suppose (I see below this is $data['user'] too...)

Currently it is this:

    case 'node':
      $node = $data['node'];
      foreach ($tokens as $name => $original) {
        if ($name == 'uuid') {
         $replacements[$original] = $node->uuid;
        }
      }
      break;

I'm suggesting this:

    case 'node':
      if (isset($data['node'])) {
        $node = $data['node'];
        foreach ($tokens as $name => $original) {
          if ($name == 'uuid') {
           $replacements[$original] = $node->uuid;
          }
        }
      }
      break;

Comments

dco’s picture

I had an issue like this

Notice : Undefined variable: replacements dans uuid_tokens() (ligne 95 in [PATH]/sites/all/modules/uuid/uuid.tokens.inc).

I added on line 48 of uuid.token.inc :

function uuid_tokens($type, $tokens, array $data = array(), array $options = array()) {
++	$replacements = array();
        switch ($type) {

Sometimes this variable is not initialized so a notice is thrown...
Could this be added ?

Renee S’s picture

Status: Active » Fixed

This appears to be in the latest dev now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

g33kg1rl’s picture

Issue summary: View changes

I don't know if this is fixed because I am receiving this error on my website with the latest version of uuid. Notice: Undefined index: entity_type in uuid_tokens() (line 51 of uuid/uuid.tokens.inc).