Closed (fixed)
Project:
Token
Version:
6.x-1.14
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Aug 2010 at 16:35 UTC
Updated:
3 Oct 2010 at 19:40 UTC
Jump to comment: Most recent file
Just tried to update to Pathauto 6.x-1.4 and Token 6.x-1.14 and it breaks the location tokens our our node paths (/admin/build/path/pathauto). Any path using the location wildcard (i.e [location-country_0]/[location-province_name_0]/[location-postal_code_0]) will get an invalid token error after updating to 6.x-1.14. If you change the tokens to location-postal_code_N the error goes away but the auto urls don't create correctly.
We backed out the token update and the problem went away.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | token-883804.patch | 486 bytes | freelock |
| #17 | token-883804.patch | 494 bytes | freelock |
| #7 | token-883804.patch | 664 bytes | freelock |
| #5 | token-883804.patch | 580 bytes | freelock |
Comments
Comment #1
freelockSame issue. Subscribing.
Comment #2
dave reidHrm, location.module doesn't actually define each token that is possible, hence it messes with token validation. I may have to easy up the token validation to messages instead of errors since other modules can't take the time to define proper tokens.
Comment #3
DrupSpa commented@ Dave Reid
Thanks for your work on this problem.
Will there be a patch / new version of the token module soon?
Or is it better to go back to Token 6.x-1.13 (is to possible to go back or will there be problems because of changes in the database, ...?)
Comment #4
thisisnotrealpeople commentedSubscribing
Comment #5
freelockBump...
Just investigating this... Location uses a token_name_N pattern for defining tokens with variable results. Is this a common pattern? If so, it seems like something to allow that during validation might be appropriate. Here's a patch against 1.14 (which appears to be the same in 1.x-dev).
Comment #7
freelockOk, rerolling the patch, from inside the module directory ;-) No actual code difference.
Comment #8
sreynen commentedThe patch looks good to cover location's N wildcard syntax, but I wonder if that syntax shouldn't be changed before it's standardized across all token-enabled modules. Specifically, I suggest adopting the db_query placeholder syntax, so location-country_N would become location-country_%d.
Comment #9
dave reidI don't think it would be easier for users to understand %d vs 'N' since end-users don't know about db_query and its placeholders.
Comment #10
sreynen commented@Dave Reid, sounds like you have a different definition of end users than I do. If you're cool with N as the wildcard, then this is RTBC.
Comment #11
freelockI did have an additional thought about this -- I wonder if the validation code should reject the _N syntax.
For example, Location defines [location-province_N] but that's not actually a valid token -- you need to use [location-province_0]. So I'm thinking that perhaps the validation code should reject [location-province_N] with a message to replace "N" with the appropriate integer... Or is that taking this too far?
Comment #12
sreynen commented@freelock, I think that makes sense, but that does nothing to solve the problem at the beginning of this thread, so it feels like it belongs in a separate issue.
Comment #13
freelocksreynen: I agree, different (but very closely related) issue. I do think this patch should get committed asap, because it's breaking functionality -- my additional proposal is probably more of a feature request/RFC...
Comment #14
dave reidOk, getting back to the root issue, this will fail for any 'token-name-N' tokens as well.
Comment #15
sreynen commented@Dave Reid, I'm confused. Do "-N" tokens already exist? The wildcard pattern in location seems to be "_N", not "-N". Are you suggesting both "_N" and "-N" should work, just in case? That feels like options just for the sake of options, not generally a great idea. Or are you saying that "N" alone should work? Making the wildcard just "N" seems almost certain to result in false positives.
Comment #16
dave reidNo they don't as far as I know, but I also haven't searched contrib to see if they do. Its not options, it's flexibility. It requires a tiny change to the patch (to support -N and _N), but if we can't do that I can commit the patch as-is.
Comment #17
freelockUpdated patch to support both -N and _N versions.
Comment #19
sreynen commentedLooks like the patch was targeting a different version. I'm guessing -dev, and changing the issue version to re-test the patch.
Comment #20
sreynen commented#17: token-883804.patch queued for re-testing.
Comment #22
freelockNo, just need to get the git diff syntax to work with simpletest in modules ;-) had it figured out for core.. trying again!
Ah, missing --no-prefix.
Comment #23
sreynen commentedLooks good to me.
Comment #24
awlo commented#22: token-883804.patch queued for re-testing.
Comment #25
nicholasthompsonLooks good to me... a +1 for this getting in! :)
Comment #26
HedgeMage commentedThe patch in #22 works great for me... +1
Comment #27
dave reidThis has been committed to D6 and D5 with additional comments and also supporting the [token-name-?] definition.
http://drupal.org/cvs?commit=424552
http://drupal.org/cvs?commit=424554