token_replace(), inside token_filter_replacetoken() is called in the following way:
$output = token_replace($token, $type, $object = NULL, $leading = '', $trailing = '');
The code actually assigns values to the $object, $leading, $trailing variables. This means that the variable $object will always be set to NULL whatever value it has been assigned to the variable before; that is also the value that token_replace() will get for its formal parameter $object.
The code should be:
$output = token_replace($token, $type, $object, '', '');
Comments
Comment #1
avpadernoPing!
Comment #2
pvhee commentedThanks for spotting this, it has been fixed in HEAD. For some reason I wasn't subscribed anymore to issues in all my modules, so sorry for the delays.
Comment #3
avpadernoThe call to
token_replace()is still wrong: rather than calling it astoken_replace($token, $type, $object, $leading = '[', $trailing = ']'), you should call it astoken_replace($token, $type, $object, '[', ']'), ortoken_replace($token, $type, $object)('[', ']'are the default values for the last two parameters, and they don't need to be used).Comment #4
pvhee commentedWow, I'm quite ashamed I made that mistake :) Thanks, I fixed it right away! (leaving the '[', ']' for clarity)
Comment #5
avpadernoYou know, four eyes see better than two. :-)
Rather than calling it a mistake, I would call it a typo; mistakes are worse than that.