Using the "raw" version of a location wildcard token in pathauto (for example, [location-city_0-raw]) produces an invalid token error. I noticed this problem after an update of token module from 6.x-1.12 to 6.x-1.15.

It looks like the regular expression in the patch that resolved #883804: Token 6.x-1.14 breaks location wildcard tokens with Pathauto 6.x-1.4 assumes the "wildcard" tokens will end with a number. This means that the variations that end with "-raw" are disallowed.

I resolved the problem for my site by changing line 539 (on token.module 6.x-1.15) from
elseif (preg_match('/^(.*[_-])\d+$/', $token, $result)) {
to
elseif (preg_match('/^(.*[_-])\d+(\-raw)?$/', $token, $result)) {

Maintainers, thanks for your work on this incredibly important module!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

isaac77’s picture

Version: 6.x-1.15 » 6.x-1.x-dev
Status: Active » Needs review
FileSize
1022 bytes

Here's a patch against 6.x-1.x-dev. I'm neither very familiar with the internals of token module nor an expert on regular expressions... so this definitely needs to be looked at. Thanks!

Dave Reid’s picture

Status: Needs review » Needs work

The last submitted patch, token-raw-version-of-wildcard-tokens-1066454-2.patch, failed testing.

bluegeek9’s picture

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