Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The following line in strongarm_init() breaks language path prefixes in Drupal 7, because it re-adds the path prefix to $_GET['q'] which had been removed inside locale_language_from_url():
$_GET['q'] = request_path();
The attached path is a workaround to the side-effects of the site_frontpage workaround, but it works.
Comment | File | Size | Author |
---|---|---|---|
#43 | strongarm-lang_pref-998070-43.patch | 889 bytes | recrit |
#38 | strongarm-lang_pref-998070-38.patch | 886 bytes | sfyn |
#29 | strongarm-lang_pref-998070-29.patch | 897 bytes | jwilson3 |
#27 | strongarm-lang_pref-998070-25.patch | 853 bytes | jwilson3 |
#28 | strongarm-lang_pref-998070-28.patch | 849 bytes | jwilson3 |
Comments
Comment #1
rvilarThis patch works for me
Comment #2
rvilarThis patch creates a conflict with overlay module. When I apply this patch, the overlay don't appears any more. O_o
Comment #3
robertgarrigos CreditAttribution: robertgarrigos commentedI'm having problems with this patch. When applied, I see an error of constant undefined (http://skitch.com/robertgarrigos/r8ymu/cesca-cesca). If I define the constant within the hook_init function, where the constant is declared, I got an error of constant already declared (http://skitch.com/robertgarrigos/r8yq3/cesca-cesca).
including once the locale.inc file solves the problem. I attach a patch against beta2 with it.
Comment #4
pivica CreditAttribution: pivica commentedHere is my version of solution - just try to remove language prefix from path because this is what's is creating a problem.
Seems to work OK. I also raised priority to major because multilingual sections of Drupal site (with language prefix in url) will not be accessible because of this bug.
Comment #5
pivica CreditAttribution: pivica commentedUpdated patch from #4 - it seems that we need to check for language_url_split_prefix function first - it will not be defined if we do not have enabled other languages on site.
Comment #6
rvilarIt works for me
Comment #7
danielnolde CreditAttribution: danielnolde commentedstrongarm-lang_pref-998070.patch from #5 works fine.
a.t.m., strongarm quite reliably breaks multilingual Drupal sites, so this need's a solution - and several are offered here.
so what's the status of this issue? Did or will any of the patches get committed?
Comment #8
rmontero CreditAttribution: rmontero commentedstrongarm-lang_pref-998070.patch from #5 works fine.
Comment #9
gagarine CreditAttribution: gagarine commented#5 works fine for me too.
Comment #10
webflo CreditAttribution: webflo commentedThis issue its related to #1062452: strongarm_set_conf() needs to be called sooner.
#1062452: strongarm_set_conf() needs to be called sooner fixes this issue and doesn't need this ugly hack in strongarm_init.
edit: fixed link to the related issue.
Comment #11
gagarine CreditAttribution: gagarine commentedI think webflo mean #1062452: strongarm_set_conf() needs to be called sooner
Comment #12
rubendevries CreditAttribution: rubendevries commented#5 works like a charm
Comment #13
benoit.pointet CreditAttribution: benoit.pointet commented#5 uses array($language_url) as a list of enabled languages. shouldn't it rather use language_list() ?
Comment #14
gagarine CreditAttribution: gagarine commentedAs say in #10 you should use and test the patch in #1062452: strongarm_set_conf() needs to be called sooner not the one in #5.
Comment #15
benoit.pointet CreditAttribution: benoit.pointet commentedAlso tested the patch in #1062452, works no better.
I'll try to isolate what causes the issue.
Comment #16
marcvangendThanks webflo & gagarine. The patch from #1062452-3: strongarm_set_conf() needs to be called sooner worked for me. Shouldn't we mark this issue as duplicate and continue over there?
Comment #17
Fabianx CreditAttribution: Fabianx commentedThis is not necessarily a duplicate as it is not clear if #1062452: strongarm_set_conf() needs to be called sooner will be accepted to fix the issue.
While hook_stream_wrappers there works fine, it is still a hack and hook_boot would be better, but has other issues.
This issue fixes only the language issue, but fixes it in a consistent way with the current code.
Best Wishes,
Fabian
Comment #18
idflood CreditAttribution: idflood commentedI've tested both patch in #5 and the one provided in #1062452: strongarm_set_conf() needs to be called sooner and both of them work. In the meantime It seems I didn't use the strongarm function that needs this "$_GET['q'] = request_path();". I comment this line the issue is also fixed.
This patch should be commited as it fixes a major issue and the second solution may take some time to be achieved.
Comment #19
neurojavi CreditAttribution: neurojavi commentedThe patch in #5 and works for me and the one in #1062452: strongarm_set_conf() needs to be called sooner #3 too.
But i can't make globalredirect to work with any of this patchs. I don't know if the problem is in strongarm or global redirect but they don't play well together. If you think the problem is in globalredirect perhaps we could open a new issue there... I'll wait for your comments before.
Thanks.-
Comment #20
marcvangendAt first (as I said in #16), the patch from #1062452-3: strongarm_set_conf() needs to be called sooner worked for me. Then for some reason the bug came back. I couldn't figure out why it came back, but I did make sure that I didn't accidentally revert the patch. After applying the patch from #5 in this issue, language prefixes work again. It seems to me that in some cases, running strongarm_set_conf() sooner isn't enough to fix this bug.
That said, @idflood raises a very good question. Why is the line
$_GET['q'] = request_path();
there in the first place? Instead of fixing this by adding code, could we fix this by removing code? I'm setting the status back to 'needs work'.Comment #21
marcvangendWe may be re-inventing the wheel here... I've looked back in the Strongarm commit history. It seems that breaking language prefixes has been a known risk for a long time. When the initial D7 version was released, the D6 version already took care of stripping language prefixes, but that was removed from D7. See the commit diff at http://drupalcode.org/project/strongarm.git/commitdiff/1a5edcb0ea5a927c5.... The current 6.x-2.x HEAD still removes language prefixes.
Comment #22
Fabianx CreditAttribution: Fabianx commentedHi,
I am setting this back to RTBC, because:
This patch fixes a known problem, which was introduced by a necessary hack. (As strongarm is running really late in the startup process by just running in _init).
If we can get this in, this will be good and showing the D6 had similar problems is just making this better.
#1062452: strongarm_set_conf() needs to be called sooner can be used for fixing this in a better way and work on other ways to fix it.
$_GET['q'] = request_path(); is there to be able to set the site_frontpage variable via strongarm.
Removing this now might break existing installations, so this is not an option.
Language prefixes were removed to let strongarm_set_conf be called again and again, but this is also not an issue here, because _init is just run once per page request. (as far as I understood)
Best Wishes,
Fabian
Comment #23
Robin Millette CreditAttribution: Robin Millette commentedsubbing
Comment #24
wanjee CreditAttribution: wanjee commentedHello,
Applied patch #5 and it seems ok, no problems detected so far.
Any news about integrating this solution in a new release ?
Thanks !
Wanjee
Comment #25
andymantell CreditAttribution: andymantell commentedShouldn't the code in patch #5 be calling drupal_multilingual() first to check if this extra step is actually necessary?
(http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/drupal...)
Comment #26
DamienMcKennaSubscribe.
Comment #27
jwilson3This patch takes the work done in #5 and applies the feedback from #25, for a slightly cleaner and self-documenting if statement.
Comment #28
jwilson3Reroll to remove whitespace #facepalm
Comment #29
jwilson3Due to the way StrongArm works, it is actually possible that drupal_multilingual() can return TRUE (as a result of a strongarmed "language_count" variable) but the Locale module be disabled which will cause a Fatal error: Call to undefined function language_url_split_prefix() in strongarm.module on line 25. :P
For this reason, I suggest we go with a combination of #25, and #5.
Comment #30
danillonunes CreditAttribution: danillonunes commentedSubscribe.
Comment #31
Gill Xu CreditAttribution: Gill Xu commented+1
Comment #32
anonSubscribe.
Comment #33
jwilson3For those of you subscribing, it would be helpful to get your feedback on the patch in #29. thanks.
Comment #34
danillonunes CreditAttribution: danillonunes commentedI'm using patch in #5 (that's almost the same of #29) and it's works well, since I already know my site is multilanguage. I'm just waiting for a definitive solution to update Strongarm and remove the patch from my makefile. Also, I don't know exactly what will be the "definitive solution", maybe #29 is fine as one.
Comment #35
czigor CreditAttribution: czigor commented#29 works for me, thanks!
Comment #36
robin.puga CreditAttribution: robin.puga commented#29 works for me too.
Many thanks for your efforts! This has been plaguing me for a few days. :-)
Comment #37
sfyn CreditAttribution: sfyn commented+1 also for the patch in #29, on 2.0-beta2.
Marking as RTBC in the hopes it will be merged in.
Comment #38
sfyn CreditAttribution: sfyn commentedHere is an update of the patch in #29 that can be successfully used with drush make 6.x-2.2 and strongarm-7.x-2.0-beta2
Comment #39
jwilson3@sfyn: cool, I wasn't aware that drush make needs the git commit hashes in there in order for it to work.
Comment #40
sfyn CreditAttribution: sfyn commentedIt doesn't, but the way that 2.2 works is that it applys patches with the flag -p0 - use the dev version of drush_make and you can use the old patch.
Comment #41
David Stosik CreditAttribution: David Stosik commentedPatch works, thanks !
Comment #42
seehat CreditAttribution: seehat commentedPatch in #38 works, but doesn't work with globalredirect 7.x-1.3
This combination leads to the following browser error: Error 310 (net::ERR_TOO_MANY_REDIRECTS).
Comment #43
recrit CreditAttribution: recrit commentedpatch #38 re-rolled on latest 7.x-2.x-dev
Comment #44
jmcneil CreditAttribution: jmcneil commented#43 worked well on dev release for me
Comment #45
jmcneil CreditAttribution: jmcneil commentedCan also confirm that #38 works on strongarm-7.x-2.0-beta2
Haven't tried with global redirect
Comment #46
mh86 CreditAttribution: mh86 commentedsubscribing
Comment #47
xibun CreditAttribution: xibun commented+1 (had "no page found" issue after enabling strongarm - patch in #43 did solve my problem)
Comment #48
floretan CreditAttribution: floretan commentedRather than applying this patch, we now use strongleg, which resolves this issue as well as any other problems with strongarm variables being defined too late in the bootstrap process.
Comment #49
sylus CreditAttribution: sylus commentedI can confirm that strongleg fixes the problem I have been having, without the need for applying either of the two patches. Much obliged!!!
Comment #50
alaa CreditAttribution: alaa commentedpatch #43 works for me, subscribing
Comment #51
xibun CreditAttribution: xibun commentedso strongleg should become a required module? haven't tested if it fixes my problem - but it would seem odd to knowingly send users into a bug.
Comment #52
DamienMcKennaIt seems foolish to use a whole extra module to work around blatant bugs in StrongArm, but it seems that this is what we have to resort to due to lack of progress on StrongArm. :-\
Comment #53
czigor CreditAttribution: czigor commentedStrongleg works for me.
Comment #54
Cyberwolf CreditAttribution: Cyberwolf commentedSubscribing.
Comment #55
bforchhammer CreditAttribution: bforchhammer commentedStrongleg works for me too.
Comment #56
Anonymous (not verified) CreditAttribution: Anonymous commentedTested strongleg and it works. It fixes this problem.
Comment #57
febbraro CreditAttribution: febbraro commentedSeems like if we remove all of the shenanigans required in hook_init() that this problem will go away too.
When we get #1094598: Performance issues from strongarm_init() in to 6 and 7 we can readdress this.
Comment #58
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedSeems that the strongleg fix also works in combination with global redirect
Comment #59
febbraro CreditAttribution: febbraro commentedDoes the patch in #32 of #1094598: Performance issues from strongarm_init() fix this issue as well? I think we were addressing the base cause there, while the patch here is just treating the symptom.
Comment #60
walkah CreditAttribution: walkah commented@febbraro Yes, #1094598 fixes the issue with locale + strongarm in my testing. Locale path prefixing now works again with strongarm 7.x-2.0-beta3. I think this one is good to close.
Comment #61
febbraro CreditAttribution: febbraro commentedSweet, thanks @walkah