When creating a content type, the following error will be output. The cause is that the variable $replacements is never instantiated.

Notice: Undefined variable: replacements in uuid_tokens() (line 103 of /drupal/sites/all/modules/uuid/uuid.tokens.inc)

The case statement has no default clause, which should be a default value for $replacement, or $replacement should be declared at the beginning then assigned values. An example of this is when type "entity" is created, is passed into this function, but sees no matching case statement. The value is never instantiated and is returned.

Code below is mostly removed, but presented for clarity to given an idea of the issue:

function uuid_tokens($type, $tokens, array $data = array(), array $options = array()) {
  switch ($type) {
    case 'node':
    case 'user':
    case 'file':
    case 'term':
    case 'comment':
  }

  return $replacements;
}

Comments

greg.1.anderson’s picture

Looks like this is already fixed in the dev version.

hexblot’s picture

if you came here from google looking for a quick fix -- just add the line $replacements = array(); as the first line of the function quoted above so that it reads

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

hope this helps someone out until it's rolled out on a normal release.

dixon_’s picture

Status: Active » Closed (fixed)

Yes, this is already fixed in the dev version. Thanks for noticing though :)

koppie’s picture

Thank you to the devs for fixing it before I even realized there was a problem. :-)

Any word on when this will make it into a stable release?