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.
You have an error message when trying to install with a different language than English and php errors are set to E_ALL:
Notice: Undefined index: locale in /install.php on line 543
as well as other
Notice: Use of undefined constant LANGUAGE_RTL - assumed 'LANGUAGE_RTL' in /includes/locale.inc on line 2236
in lines 2236, 2271, 2285, 2352 and 2396
Note that in order to reproduce this error you need to install a new lang.po file inside /profiles/default/translation and not in drupal root directory as stated in the instructions shown during installation (I have already reported about it)
Comment | File | Size | Author |
---|---|---|---|
#26 | drupal6.install-language-d6.patch | 5.41 KB | sun |
#26 | drupal.install-language.patch | 5.35 KB | sun |
#25 | language-constants-D6.patch | 7.76 KB | c960657 |
#23 | issue-203323-21-D6.patch | 2.22 KB | thePanz |
#21 | issue-203323-21.patch | 2.22 KB | lilou |
Comments
Comment #1
JirkaRybka CreditAttribution: JirkaRybka commentedInstall.php line 543 should be
if (isset($_POST['locale']) && $_POST['locale'] == $locale->name) {
- that code runs on every single page until you've selected a valid locale, but $_POST is empty first time (or on a page reload). The LANGUAGE_RTL constant is defined in locale.module - so locale.inc should not run without of locale.module (note: the later locale.inc includes in install.php are OK, because these are after full bootstrap with modules included, and locale module installation is enforced earlier by the very same condition, i.e. $install_locale != 'en').Please test the attached patch.
Comment #2
robertgarrigos CreditAttribution: robertgarrigos commentedFatal error: Call to undefined function db_query() in /includes/bootstrap.inc on line 466
Comment #3
robertgarrigos CreditAttribution: robertgarrigos commentedComment #4
robertgarrigos CreditAttribution: robertgarrigos commentedI think it would be much coherent with the purpose of an included file to have those constants defined within locale.inc, not in locale.module. Doesn't make much sense to have locale.module included to the install process only for those constant definitions. This patch here applies part of the previous patch but move constant definition to locale.inc, so this file is patching three core files.
Comment #5
JirkaRybka CreditAttribution: JirkaRybka commentedI feel really uneasy about moving RTL constants to locale.inc:
locale.module is the main code for localization, always included (only it wasn't in the install process, by mistake I believe), while locale.inc is an additional part, generally relying on locale.module in many ways, only included in some special cases. Moving the definitions to locale.inc, you'll most probably cause problems with RTL languages on installed Drupal site, as the constants will be then undefined on regular localized pages, where locale.inc is generally NOT included. Note that the constants are not just local stuff, they are used on several places across the Drupal code.
The fatal error mentioned at #2 indicates a variable_set() call before database bootstrap. I can't reproduce that, can you give more information how to reproduce? But anyway, that's not related to my patch at #1. So #1 is the one for review, still, as far as I can tell.
Comment #6
robertgarrigos CreditAttribution: robertgarrigos commentedThe error at #2 appears when applied your patch at #1 on a drupal-head, php 5 with errors E_ALL. I'm using a mamp server instal·led with mamp (http://mamp.info) I'm having the same error with downloaded drupal 6 RC 1 and your patch.
In any case, I don't think we should include a full module only because we need two constants defined in it. That should be the function of an .inc file, which should be included everywhere when its needed. That's why locale.module calls locale.inc when it needs it with the function locale_inc_callback(). I don't think we should have any problem to have all constants defined within locale.inc and not within locale.module. And if it is the case, we should call locale.inc within locale.module when necessary.
Comment #7
JirkaRybka CreditAttribution: JirkaRybka commentedThe purpose of locale.inc is to NOT include unnecessary things on regular pages. The constants are used also elsewhere, so they are not "hidden" into that file. We're not going to re-arrange the way how Drupal is split into files here, post RC. Note that locale.inc is NOT a general include file (like includes/common.inc and others) - this one is different due to purely historic reasons, and serve a purpose similar to files like system/system-admin.inc and similar. It's internal add-on for administrative tasks inside locale.module, which make generally no sense without it's parent module included.
Otherwise no time to test now, sorry for the delay.
Comment #8
robertgarrigos CreditAttribution: robertgarrigos commentedThat's right, that's why I propose to move the constants to the .inc file, because these are the only things we need while installing AND they will always be available to locale.module anyway, so I don't see where is the problem.
Comment #9
JirkaRybka CreditAttribution: JirkaRybka commentedThe constants will NOT be always available to locale.module. The file locale.inc is not included in most cases, it's only included in the rare situations when administrative tasks need to be performed. In all other cases, any constants defined in locale.inc are NOT available, although locale.module is in use. I also discovered, that the base system checks for these constants too (drupal_add_css() - common.inc), so changing the behavior is not a safe thing.
Comment #10
robertgarrigos CreditAttribution: robertgarrigos commentedok. fair enough. Why not including those constants in common.inc then? it really doesn't make sense to me to have to include a full module just for two constants when, even more, it triggers a fatal error....
Comment #11
JirkaRybka CreditAttribution: JirkaRybka commentedWe need to research WHY it triggers an error in the first place.
Comment #12
kkaefer CreditAttribution: kkaefer commentedI'd say it is safe to move the constants to locale.inc because in all other instances (in Drupal core), a defined() check is used before using the constant.
Comment #13
JirkaRybka CreditAttribution: JirkaRybka commentedEh, as far as I see, in common.inc the constant is used to add RTL stylesheets. Of course this only makes sense on a localized site, where locale.module is included, so that's the purpose of defined() check. Now if we move the constants to locale.inc, which is only included rarely (for administrative tasks), the constants will be undefined on regular pages (although locale.module is in use). Sure, defined() check will avoid PHP warnings, but the point is, that the *functionality* will be broken! No RTL stylesheets added, so on all Arabic, Hebrew and other RTL sites, RTL theming will be gone (except for administrative pages).
Fixing an installer notice by introducing a critical runtime RTL-theming bug is not nice.
Comment #14
Gábor HojtsyGrepping for the constants:
All the times, the defined() check is there because if the locale module is not included, the constants are not available. Actually, we could do some cleanup by:
- moving the constants to some more common place (language.inc I would say, which is always included past the language bootstrap phase => then we should check that nothing requires it before/without the language bootstrap)
- removing the defined() checks
The critical part of the conditionals above is the $language->direction == LANGUAGE_RTL, the defined() is just there to serve as an E_ALL defense on cases, when the constant might not be there.
Comment #15
robertgarrigos CreditAttribution: robertgarrigos commentedYep, you are right, JirkaRybka, I checked that.
I think the best place to put those constant definitions is within bootstrap.inc, where there actually some other language definitions, because these are needed even for cached pages. Bootstrap.inc gets included for cached pages.
So this is the patch with those constants moved to bootstrap.inc. This is a patch to apply to HEAD.
Comment #16
robertgarrigos CreditAttribution: robertgarrigos commentedThis patch is still needed for RC3. It would be nice if somebody could review it so it could be applied to D6.
Comment #17
robertgarrigos CreditAttribution: robertgarrigos commentedrerolled to dev because still needed if we want to be E_ALL compliant
Comment #18
ScoutBaker CreditAttribution: ScoutBaker commented@robertgarrigos: #17 says "rerolled". Is there supposed to be a new patch attached? Thanks.
Comment #19
robertgarrigos CreditAttribution: robertgarrigos commentedSorry, provably the word 'rerolled' is not the right one. I meant that the path at #15 is still applicable to 7.x-dev. I tested it and needs review.
Comment #20
Tyrael CreditAttribution: Tyrael commentedYou should put the
if(!empty($_POST['locale'])){
before the foreach, so if it isn't set, then its unnecessary to walk trough the array.
Tyrael
Comment #21
lilou CreditAttribution: lilou commentedReroll patch #15 against CVS/HEAD and add check
$_POST['locale']
before foreach according to #20.Comment #22
Dries CreditAttribution: Dries commentedIf we are going to define these constants in bootstrap.inc, we should be able to remove many of the 'if defined' checks? More code clean-up would be in order, not?
Comment #23
thePanz CreditAttribution: thePanz commentedI've ported #21 patch to Drupal 6.8
Waiting for reviews... and for a commit ;)
Regards! :)
Comment #24
jpereza CreditAttribution: jpereza commentedI've tested the patch at #23 with Drupal 6.8 and it installed succesfully using spanish language with no errors.
Thanks thePanz for the patch!
Comment #25
c960657 CreditAttribution: c960657 commentedThis patch removes the defined() calls as requested in #22. The constants are defined very early in the bootstrap process (prior to calling drupal_bootstrap()), so none of these are necessary anymore.
Comment #26
sunWow. This is probably the most annoying thing that can happen when you try, test, or install Drupal for the first time. Bumping to critical.
Attaching patches for both D7 and D6.
Comment #27
webchickNice. I love these patches that make sensible changes and remove a bunch of silly conditionals at the same time.
Committed to HEAD. Moving back to 6.x. However, I disagree with critical status. Not nice, yes, but it only affects environments with E_ALL reporting in php.ini which is not the norm for production sites.
Comment #28
sunEffectively, the patch for 6.x is the identical.
Comment #29
sunEffectively, the patch for 6.x is the identical.
Comment #30
Gábor HojtsyThanks, committed to Drupal 6 as well.