For some reason yesterday Comment Subject stopped working on my test site: token names (even those not depending on Token module) would show up in subjects, instead of their replacements. I have not been able to identify what caused the problem, but changing the weight of comment_subject module, from 20 to 0, fixed it. Is there any guideline regarding this module's weight?

CommentFileSizeAuthor
#22 2010-01-26_issue_680444(unix).patch1.98 KBarhak

Comments

arhak’s picture

Component: Miscellaneous » Token support
Category: support » bug
Priority: Normal » Critical

this would be critical
but, what caused it? conflict with another module?
how could I reproduce it?

the weight is not a critical issue regarding this module, it is set to 20 to be above token module (which has 10) just in case there is function theme_token_list already declared
note: that function doesn't exists in token module (AFAIK), but is proposed as a patch, so it might appear some day and brake if comment_subject executes before token

right now I can't see another strong reason for the weight other that form_alter assigning the #default_value to subjects, which might be broken if another module jumps in an try some tweaks, or... can't figure now another way

arhak’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce it
what other modules are involved?
can you reproduce it on a fresh install and provide the steps to follow?

skizzo’s picture

By trial and error I narrowed it down to some sort of interaction with custom_breadcrumbs (6.x-2.0-beta2) . I then set the module's weight back to 20 and now I can reproduce the malfunction by just enabling custom_breadcrumbs (base module only, no need to configure any breadcrumb). In my original setup custom_breadcrumbs_paths and custom_breadcrumbs_views were also configured.

arhak’s picture

Title: Tokens not expanded » Tokens not expanded when using custom_breadcrumbs
Assigned: Unassigned » arhak
Status: Postponed (maintainer needs more info) » Active

I'll download the latest version of custom_breadcrumbs and check this conflict

arhak’s picture

@#3 BTW, which version of custom_breadcrumbs? 6.x-1.5 or 6.x-2.0-beta2 ?

arhak’s picture

@#5 should be 6.x-2.x branch, which is the one with sub-modules

arhak’s picture

Status: Active » Postponed (maintainer needs more info)

still can't reproduce it
- enabled custom_breadcrumbs 6.x-2.0-beta2 and no problem
- cleared the cache (to avoid cached forms) and no problem
- enabled "Custom Breadcrumbs for Paths", cleared the cache and no problem
- manually set weight=12 for custom_breadcrumbs at {system} table and no problem (details bellow)

reviewing the code I can't find custom_breadcrumbs setting its weight
but the custom_breadcrumbs_update_3 states:

// Ensure this module's weight is larger than other modules, like views, so custom breadcrumbs page callback is used.
function custom_breadcrumbs_update_3() {
  $ret[] = update_sql("UPDATE {system} SET weight = 12 WHERE name = 'custom_breadcrumbs'");
  return $ret;
}

that's why I manually set its weight to 12 for testing (it was 0 on fresh install) and though couldn't reproduce the error

this weight problem, should be found and properly fixed,
in the meantime, lets say comment_subject might happily use weight=11 (which is greater than token and less than custom_breadcrumbs), also, I consider custom_breadcrumbs using 12 is a narrow margin (maybe they should increase that weight), since token has 10

yet, I can't take any certain action, since I haven't been able to reproduce it

skizzo’s picture

Following your note I set custom_breadcrumbs to 12. With the following weighting I still see the problem:

12 custom_breadcrumbs 
13 comment_subject

Token replacement is back to normal with:

12 comment_subject
12 custom_breadcrumbs

I settled with the same weights of your test (btw, I have no other module in the 11-13 range)

11 comment_subject
12 custom_breadcrumbs
arhak’s picture

could you please provide every configuration you have related to custom_breadcrumbs or its sub-modules?
I need to reproduce this error to be able to figure out what would be the real fix

arhak’s picture

MGN’s picture

I think this may be related to #543506: Problem with tokens when using a custom_bredcrumbs_paths. I'll have to look at the comment subject code to be sure. But if this is the case, once tokens issues a new release we should be able to fix this problem....

arhak’s picture

@MGN
thanks a lot for getting involved, that might be the reason why I haven't been able to reproduce this error
we actually have a token_replace($str, 'comment', $comment); which might be conflicting with custom_breadcrumbs due to token cache

@skizzo
I've never tried custom_breadcrumb_paths nor custom_breadcrumb_views
having your configuration would help me to hit this error

skizzo’s picture

A) in admin/settings/custom-breadcrumbs all defaults, barring:
YES Set the home breadcrumb text on all pages
YES Use wildcard pattern matching in paths

B) THREE PATH BREADCRUMBS:

Name: search/user
Specific Path: search/user
Titles: Community
Paths: userview/directory

Name: users/* Pathauto for users is set to: users/[user-raw]
Specific Path: users/*
Titles: Community
Titles: Search user
Paths: userview/directory
Paths: search/user

Name: userview/directory userview is a table view listing profile nodes
Specific Path: userview/directory
Titles: Search user
Paths: search/user

C) TWO VIEWS BREADCRUMBS one and two are tabs for userview

Name: userview/directory/two
Views Path: userview/directory/two
Titles: Search user
Paths: search/user

Name: userview/directory/one
Views Path: userview/directory/one
Titles: Search user
Paths: search/user

arhak’s picture

@MGN http://drupal.org/node/543506#comment-2460544

any two modules using token_replace_multiple on the same page request are likely to show this problem

just with token_replace_multiple?
this module uses token_replace, but not _multiple

arhak’s picture

@#14 the flushing cache problem affects token_replace as well, but I can't be sure that it is the cause, since I'm blind yet (haven't reproduce it)

arhak’s picture

Status: Postponed (maintainer needs more info) » Needs work

good news!!
I've got it!

I reproduced this bug (wow, tough hunting)

thanks MGN for you insight
thanks skizzo for your patience

details & fix coming soon

arhak’s picture

@skizzo just to confirm
which tokens where you using and notice the missing replacements?

skizzo’s picture

[comment-auto-numbering]
[comment-parent-auto-numbering]

arhak’s picture

how to reproduce this bug (thanks for the clue MGN):
- fresh Drupal 6.15
- comment_subject 6.x-2.0-alpha2
- custom_breadcrumbs 6.x-2.0-beta2
- enable custom_breadcrumbs_paths as well
- token 6.x-1.12
- admin/settings/custom-breadcrumbs
--- check "Use wildcard pattern matching in paths" and save
- admin/build/custom_breadcrumbs/path/add
--- Specific Path: comment/reply/*
--- Titles: Original post
--- Paths: node/[comment-nid]
- create a story (node/1)
- create a comment replying to that story (node/1#comment-1)
- reply to the previous comment (comment/reply/1/1)
- on that path subject appears broken (tokens weren't replaced)

a quick test to check if it is due to custom_breadcrumbs (thanks for the clue skizzo):
- change the weight of custom_breadcrumbs_paths to something above 20 (the greatest the better to discard any other module with tokens being affected by this)
--- UPDATE `system` SET `weight` = '100' WHERE `filename` LIKE '%/custom_breadcrumbs_paths.module';

more technical details about why is this happening: #543506-4: Problem with tokens when using a custom_bredcrumbs_paths

the final solution:
- the cause is located
- a possible fix is to move hooks token_value & token_list inside comment_subject.module instead of a separated file (currently at comment_subject.token.inc)
- but I'll wait until getting in touch with other developers to check if this is actually a bug of comment_subject #681938: document proper practice for mymodule.token.inc files

arhak’s picture

Status: Needs work » Postponed (maintainer needs more info)

a patch for custom_breadcrumbs is available at #627792-8: Custom Breadcrumb option causes Access Denied in OG Forums
it seems to solve this issue, but can't say if every other cb functionality remains working, its maintainer is asking for users testing that patch

this issue will remain postponed, since policy about *.token.inc files is now in D7 core, therefore there shouldn't be any requirement to include those hooks into the *.module file

arhak’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

no longer an issue of this module
details at #543506-4: Problem with tokens when using a custom_bredcrumbs_paths, and patch at #627792-8: Custom Breadcrumb option causes Access Denied in OG Forums was committed to custom_breadcrumbs HEAD and seems to fix this incompatibily problem (according to skizzo's feedback through mail)

arhak’s picture

Title: Tokens not expanded when using custom_breadcrumbs » Tokens not expanded when using custom_breadcrumbs (AKA hook_init might be to late to declare token hooks)
Version: 6.x-2.0-alpha2 » 6.x-2.x-dev
Status: Closed (fixed) » Needs review
StatusFileSize
new1.98 KB

this will get into next 6.x-2.x release

arhak’s picture

Status: Needs review » Fixed

committed to head (proposed 6.x-2.0-beta1)

arhak’s picture

Status: Fixed » Closed (fixed)

clearing the issue queue
(this was more kind of reminder)
this issue was troubleshooted directly with the user, plus custom_breadcrumbs got updated to avoid nasty hook_init, plus dev already avoids this