Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
To reproduce:
- Enable locale module
- Configure the site with more that one language
- Set 'language negotiation' with 'path prefix'
- Disable a language
- The disabled language paths are still valid
This patch checks the state of the language part of the url.
Comment | File | Size | Author |
---|---|---|---|
#8 | enabled_language_d.patch | 2.23 KB | theborg |
#6 | enabled_language_c.patch | 1.7 KB | theborg |
#2 | enabled_language_b.patch | 1.52 KB | theborg |
enabled_language_a.patch | 806 bytes | theborg | |
Comments
Comment #1
Gábor HojtsyWell, this looks like a more widespread bug here. All of language_initialize() uses the complete language list, not only the enabled languages. We should have a common
$languages = language_list('enabled'); $languages = $languages[1];
at the top and use that IMHO.Comment #2
theborg CreditAttribution: theborg commentedAfter some tests I agree with Gábor comments that all of language_initialize() should use only the enabled languages.
Patch reformed with
$languages = language_list('enabled'); $languages = $languages[1];
.Also note that after removing
language_list('prefix');
from 'path prefix mode' the paths with the default language (en) on the url are also valid:Comment #3
theborg CreditAttribution: theborg commentedComment #4
Gábor HojtsyThis looks buggy, because the array used in the LANGUAGE_NEGOTIATION_PATH* cases is indexed with the path prefix and not the language code. If I apply your patch, the custom path prefix feature goes away, and it is only possible to use the language code as path prefix.
Comment #5
Gábor HojtsyI mean it is indexed by path prefix before the patch but indexed by language code after the patch.
Comment #6
theborg CreditAttribution: theborg commentedAy!, didn't notice the custom path prefix feature, sorry.
With reordered $language array by prefix.
Comment #7
Gábor HojtsyWell, I'd rather do foreach on the language list as in LANGUAGE_NEGOTIATION_DOMAIN and return when found instead of building up a temporary array. Also renaming the $language temp variable in LANGUAGE_NEGOTIATION_PATH* to $prefix makes a lot of sense. Don't know why we did not do that initially.
Comment #8
theborg CreditAttribution: theborg commentedAdded foreach block.
Using $prefix as variable.
Thanks Gábor.
Comment #9
Gábor HojtsyLooks much better. I committed this with one extra line of comment added in the $mode == LANGUAGE_NEGOTIATION_PATH_DEFAULT case. Thanks!
Comment #10
(not verified) CreditAttribution: commentedAutomatically closed -- issue fixed for two weeks with no activity.