Download & Extend

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

Project:Universally Unique IDentifier
Version:7.x-1.0-alpha3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

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).

Comments

#1

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

#2

subscribe

#3

I'm getting the same error.

#4

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.

#5

Status:fixed» closed (duplicate)

#6

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

#7

same problem any fix?

#8

Category:bug report» support request

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) {
"

#9

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

#10

Thank you trangunghoa for your help.

#11

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

#12

Awesome, thanks for the fix!

#13

where add the line it??

#14

Thanks...this fixed my error too.

#15

@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.

#16

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

#17

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

#18

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

#19

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

#20

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

#21

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

All the best.

#22

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

AttachmentSizeStatusTest resultOperations
uuid.token_.inc-undefined-replacements.patch433 bytesIdleFAILED: [[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 details | Re-test

#23

#22 patch worked for me

#24

Patch #22 worked for me also. Thanks!

#25

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

#26

22 Worked for me.

Thanks. Should commit this no?

#27

Status:closed (duplicate)» reviewed & tested by the community

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

Please put #22 in.

#28

Status:reviewed & tested by the community» needs work

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

#29

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.

#30

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.

#31

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.

#32

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

#33

Status:closed (duplicate)» needs review

#22: uuid.token_.inc-undefined-replacements.patch queued for re-testing.

#34

Status:needs review» needs work

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

#35

Status:needs work» fixed

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

#36

Category:support request» bug report

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

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

#37

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.

#38

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

#39

Status:closed (duplicate)» needs review

#22: uuid.token_.inc-undefined-replacements.patch queued for re-testing.

#40

Status:needs review» needs work

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

#41

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.

nobody click here