I am using D7 Beta1 and Token module 7.x-1.0-alpha 3. With the token module enable and no warning generated for other modules. Enabling the Login Toboggan module resulted in the following warning message:
Error message
Warning: uasort(): Array was modified by the user comparison function in token_get_info() (line 226 of /home/ww7ba/mobilesoftwaredev.com/sites/all/modules/token/token.module).
I had seen this error in a previous release of D7, but was unable to identify the module that was generating the message. The message now appears every time I enable a new module. If I disable Login Tobbogan the warming message goes away.
Comment | File | Size | Author |
---|---|---|---|
#12 | 936738-logintoboggan-token-cleanup-D7.patch | 3.94 KB | Dave Reid |
#7 | 936738-logintoboggan-token-cleanup-D7.patch | 3.93 KB | Dave Reid |
Comments
Comment #1
hunmonk CreditAttribution: hunmonk commentedplease try the latest development snapshots of all involved code and see if the issue still persists. also, can you reproduce this or a similar problem without enabling token module? if not, then the issue may also be with token module.
also, a warning is not a critical issue... ;)
Comment #2
billsdesk CreditAttribution: billsdesk commentedI would gladly download and test the dev release, but it is not available from the module page. I was thinking about using CVS, but I don't have time for that approach.
I have already communicated with the Token maintainers, and they send me on the track to find the module that generated the warning messages. Of the many modules I have installed, Login Toboggan was the one that generated the error message. All other modules passed this test, but many failed in other tests.
Sorry about the over escalation. I have so many discrepancy reports filed for 7.x, that I some times overreact to get the attention of the developer.
Comment #3
hunmonk CreditAttribution: hunmonk commentedcould you please explain the process? the warning message clearly shows that the warning is being generated by code in the token module, so i'm not sure how you're arriving at logintoboggan as the culprit.
sure it is. click on 'View all releases', and scroll down to the 'logintoboggan 7.x-1.x-dev' release.
i'll wait for your report.
Comment #4
billsdesk CreditAttribution: billsdesk commentedI downloaded and enabled the dev version, and still receive the warning message:
Warning: uasort(): Array was modified by the user comparison function in token_get_info() (line 226 of /home/ww7ba/mobilesoftwaredev.com/sites/all/modules/token/token.module).'
If I disable login toboggan the message goes away.
I like your module, which is why I am willing to test it.
Comment #5
Jarode CreditAttribution: Jarode commentedHello,
I'm using Drupal 7.0-beta1 and logintoboggan-7.x-1.0-alpha3.
I have a similar error message when I enable loggingToboggan.
Then, just after I reload modules page to see if the warning persist and I get that one:
Any idea ?
Need more infos ?
Thanks.
Comment #6
hunmonk CreditAttribution: hunmonk commented@billsdesk: you haven't answered this question...
Comment #7
Dave ReidThe problem is that the token implementation in logintoboggan is just plain wrong.
1. The reported bug was caused because the module defined $info['types']['logintoboggan']['logintoboggan-validation'] = array() which is one level too many. Futhermore...
2. There's absolutely no need to define your own token type for just one token when this is obviously a user-related token. Modules had to do this with Drupal 6 because there were literally hundreds of tokens stuffed into node and user token types, but with token chaining in D7, that's no longer a problem. Patch moves the token to [user:validate-url] which just makes sense.
3. Removed unnecessary code copied from another token implementation.
4. Don't return any token value if you shouldn't be doing so. That's why we have $options['clean'] = TRUE in token_replace() rather than having modules return NULL values (it should be up to the module performing the token replacement decided what to do).
5. I've also moved the code to logintoboggan.tokens.inc as that's the standard for token-related functions in D7.
Comment #8
Dave ReidTagging so I can keep track of all the modules I'm helping cleanup tokens for D7 with...
Comment #9
Jarode CreditAttribution: Jarode commentedThanks for this patch, perfect. ++
Comment #10
Dave Reidgoing to assume that was a cross-post. :)
Comment #11
hunmonk CreditAttribution: hunmonk commented@Dave Reid: shouldn't
case 'url':
becase 'validate-url':
?Comment #12
Dave ReidYep, good catch.
Comment #13
hunmonk CreditAttribution: hunmonk commented@Dave Reid: i'm a bit confused about putting the hooks in a separate file -- don't hooks normally go in the main .module file so they are accessible to other modules? also, how is this token.inc file loaded? does the core token code handle that?
@all: could somebody please test this latest patch to make sure it actually works as intended?
Comment #14
Dave ReidCore automatically allows any of the token hooks to be put in a modulename.tokens.inc file because of the new hook_hook_info() in D7 (token hooks are declared in http://api.drupal.org/api/function/system_hook_info/7). Its why we can have modules/node/node.tokens.inc and modules/system/system.tokens.inc, etc in core.
Comment #15
Dave ReidUsing the user/%/devel pages available from Token module, my uid 1 user gets a [user:validate-url] token value of http://example.com/user/validate/1/1287202188/gsSHU39M3fQC-4vM-MAtF8_-KR...
Once I set the 'user registration' variable back to admin approval, I get an empty token as expected.
Comment #16
hunmonk CreditAttribution: hunmonk commented@Dave Reid: thanks for all your help on this!
committed to HEAD.
Comment #17
Dave ReidWoot, thanks to you too hunmonk!
Comment #18
HongPong CreditAttribution: HongPong commentedsub