After installing alpha3 release, any attempt to edit any content results in the following message.

  Notice: Undefined variable: replacements in uuid_tokens() (line 95 of ...sites\all\modules\uuid\uuid.tokens.inc).

In the newly updated uuid_tokens function in uuid.tokens.inc, if the $type is not one of the values in the switch block (node, user, file, term, or comment), an attempt is made to return $replacements. However, the $type is 'entity' which does not match any of the values in the switch block. The $replacements variable is undefined and the return fails.

Probably the $replacements variable should be defined as an empty array prior to the switch block. I do find it odd that no test is made for a $type of entity.

I see that this function has been replaced since alpha3. The newly written function available in the dev version as of 2/4/2012 also fails, but with different messages.

Notice: Undefined index: uuid in uuid_tokens() (line 38 of ...sites/all/modules/uuid/uuid.tokens.inc).
Notice: Undefined index: vuuid in uuid_tokens() (line 40 of .../sites/all/modules/uuid/uuid.tokens.inc).
Files: 
CommentFileSizeAuthor
#22 uuid.token_.inc-undefined-replacements.patch433 bytestimaholt
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch uuid.token_.inc-undefined-replacements.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

3rdLOF’s picture

Exact same problem with identical errors on the content edit page.

jzornig’s picture

subscribe

cpelham’s picture

I'm getting the same error.

dixon_’s picture

Status:Active» Fixed

This is a duplicate of #1423542: Rewrite token integration to be more entity generic and fixed in 7.x-1.x-dev already.

dixon_’s picture

Status:Fixed» Closed (duplicate)
Torenware’s picture

Fixed, but is there a released version that has the fix? Or do you recommend the dev build for this?

heckad’s picture

same problem any fix?

trangunghoa’s picture

Category:bug» support

I fixed this error by:
add line "$replacements = array();" in head function uuid_tokens

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

bagpiper’s picture

Thank you, that did the trick Trangunghoa. Hope we get the beta release for UUID soon :-)

flashwebcenter’s picture

Thank you trangunghoa for your help.

yannickoo’s picture

Saw this in the dev release so it's fixed.

csander’s picture

Awesome, thanks for the fix!

Citlalli’s picture

where add the line it??

jmonroe’s picture

Thanks...this fixed my error too.

jmonroe’s picture

@Citlalli - You need to add it under line 95 of /sites/all/modules/uuid/uuid.tokens.inc

So line 95-97 looks as below

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

That will fix it for you.

Citlalli’s picture

i put it, it isnt working :S, I am using local server, may be is for that isnt?

luistope’s picture

It works for me!
@Citlalli be careful with the copy paste. + $replacments = array(); is + $replacements An 'e' misses in jmonroe solution. ;)

kyke01’s picture

It's works for me too but without the + sign ,
just add $replacements = array(); to the function

Myoos’s picture

trangunghoa : thank u soo much this was help full =)

Seb36’s picture

thanks trangunghoa
kyke01 Lines beginning with "+" are added (without the "+", of course).
http://drupal.org/node/534548

gregmarsh’s picture

Just wanted to say thank you for this ... very simple and quick fix.

All the best.

timaholt’s picture

StatusFileSize
new433 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch uuid.token_.inc-undefined-replacements.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

For anyone using drush make and the alpha3 release, here's a patch for this issue.

roborracle’s picture

#22 patch worked for me

shrop’s picture

Patch #22 worked for me also. Thanks!

kyleoliveira’s picture

#15 seems to have fixed the issue for me. I would definitely suggest adding it in the next release.

Exploratus’s picture

22 Worked for me.

Thanks. Should commit this no?

Offlein’s picture

Status:Closed (duplicate)» Reviewed & tested by the community

This probably won't get fixed because the status was closed.

Please put #22 in.

Status:Reviewed & tested by the community» Needs work

The last submitted patch, uuid.token_.inc-undefined-replacements.patch, failed testing.

skwashd’s picture

Status:Needs work» Closed (duplicate)

This issue has previously been closed as a duplicate of #1423542: Rewrite token integration to be more entity generic. I am closing it again.

windmaomao’s picture

so what is the issue to not commit this simple change to the repository ? Can someone explain why this line is not considered a good commit ? thanks. I'm puzzled, since everytime i do a drush dl uuid, i have to come back add this fix.

Offlein’s picture

I'm sorry, I hadn't followed this properly, but I suspect, windmaomao, that you're not using Drush will only download the -alpha3 version, not the -dev version, and hence you're not dl'ing the latest code?

If you ARE, try submitting a new ticket.

timaholt’s picture

Not sure why the patch failed testing as it patches correctly for me manually and using drush make. Any ideas?

chrisjlee’s picture

Status:Closed (duplicate)» Needs review

Status:Needs review» Needs work

The last submitted patch, uuid.token_.inc-undefined-replacements.patch, failed testing.

chrisjlee’s picture

Status:Needs work» Fixed

I just updated to the dev release and it seems to have disappeared.

ascii122’s picture

Category:support» bug

The latest 7.x-1.0-alpha3 version has a typo: File: uuid.tokens.inc Line 48

$replacments = array();
should be
$replacements = array();

pfrenssen’s picture

Status:Fixed» Closed (duplicate)

This has not been fixed here but in #1423542: Rewrite token integration to be more entity generic, marking this as a duplicate of that issue.

dgamache’s picture

$replacements = array();
Patch is not working for me.
drupal core 7.21
Open Enterprise Profile
Universally Unique ID 7.x-1.0

kwfinken’s picture

Status:Closed (duplicate)» Needs review

Status:Needs review» Needs work

The last submitted patch, uuid.token_.inc-undefined-replacements.patch, failed testing.

pfrenssen’s picture

Status:Needs work» Closed (duplicate)

No need to test the patch or reopen this issue. This has long been fixed in the development version. Don't use the 7.x-1.0-alpha3, it is over a year old. Use 7.x-1.x-dev.

Marking this as a duplicate of #1423542: Rewrite token integration to be more entity generic, this is the issue in which this problem was fixed.

Status:Closed (duplicate)» Needs review

Status:Needs review» Needs work

The last submitted patch, 22: uuid.token_.inc-undefined-replacements.patch, failed testing.

pfrenssen’s picture

Issue summary:View changes
Status:Needs work» Closed (duplicate)

No need to test the patch, this issue has already been fixed over 2 years ago in #1423542: Rewrite token integration to be more entity generic.