I updated to the latest version of token (1.18), and now Im receiving this error in log:

The _custom_links_build_links() function called token replacement with an array rather than a string for $text in.... /sites/default/modules/token/token.module on line 263.

Does something in this module need to be changed?

CommentFileSizeAuthor
#8 custom_links.fix-token_replace-error.patch587 bytesedegro

Comments

elektrorl’s picture

Same problem. Token module update brings this problem too.

venusrising’s picture

We too have this issue after Token same issue as with custom breadcrumbs

jnettik’s picture

Same problem as #2 is having.

jnettik’s picture

Status: Active » Closed (won't fix)

So this looks like a problem with the offending modules. For custom_breadcrumbs there's a patch for the dev and stable releases in #1327960: Invalid use of token_replace API - causes preg_match_all errors in token module.

beyond67’s picture

Will a patch be made for this module? Should this issue be brought up on the token issue log?

jnettik’s picture

Status: Closed (won't fix) » Active

I think Token's maintainers will just say someone needs to submit a patch for this module. Nothing they can really do. Not sure if one is in the works for this module or not.

beyond67’s picture

I hope someone does address this issue with a patch. Unfortunately, I am a novice when it comes to module development. The token module is a popular module that is used by many modules. So I can see this becoming a larger and lagging issue to those who use this module.

edegro’s picture

StatusFileSize
new587 bytes

Here's a patch following the fixed used in the same custom_breadcrumbs issue. One of my old sites just happens to be using both modules...

AlexisWilke’s picture

Status: Active » Reviewed & tested by the community

edegro,

That patch works fine, although I'm not too sure whether the is_string() test is required. Did you have a problem without it? I tried without the condition and it works for me.

    if (module_exists('token')) {
      foreach($links[$link->link_key] as $key => $value) {
        $links[$link->link_key][$key] = token_replace_multiple($value, array('node' => $node));
      }
    }

Thank you.
Alexis