Since the URL language provider is always invoked on multilingual sites, as it is tied to the non-configurable URL language type, path prefixes are always active, even when the URL language provider is disabled for the interface language.

This is a wrong behavior as path prefixes should be active only if the URL language provider is enabled for a configurable language type.

To reproduce this just add the French language and visit http://example.org/fr: the french front page is shown instead of a 404 error.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plach’s picture

Status: Active » Needs review
FileSize
4.34 KB

The attached patch makes the URL language provider look for path prefixes only if it's enabled for at least one configurable language type.

Probably tests need to be fixed, but let's see if the bot is happy with this one first.

Status: Needs review » Needs work

The last submitted patch, language-780318-1.patch, failed testing.

plach’s picture

Status: Needs work » Needs review
FileSize
8.62 KB

Tests should be fixed now.

Since the URL language provider is always invoked on multilingual sites [...]

Note: this is true only after submitting the language detection and selection form at least once.

plach’s picture

Priority: Normal » Critical

Moving to critical as this prevents an upgrade path test to complete successfully and it is somehow an upgrade path issue itself.

plach’s picture

#3: language-780318-3.patch queued for re-testing.

juan_g’s picture

plach wrote:

Moving to critical as this prevents an upgrade path test to complete successfully and it is somehow an upgrade path issue itself.

I think that's #812416: Locale upgrade path broken.

plach’s picture

Exactly :)

Status: Needs review » Needs work

The last submitted patch, language-780318-3.patch, failed testing.

plach’s picture

Status: Needs work » Needs review
FileSize
5.44 KB

Rerolled

Damien Tournoud’s picture

Status: Needs review » Reviewed & tested by the community

Yay. This adds a tad of complexity to the bootstrap process (a few loops and variable_get calls), but it only affects multilingual sites.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

fortis’s picture

Issue summary: View changes
Status: Closed (fixed) » Needs review
FileSize
449 bytes

there is installation notices in locale.module

Notice: Use of undefined constant LOCALE_LANGUAGE_NEGOTIATION_URL - assumed 'LOCALE_LANGUAGE_NEGOTIATION_URL' in locale_language_negotiation_info() (line 570 of /modules/locale/locale.module).
Notice: Use of undefined constant LOCALE_LANGUAGE_NEGOTIATION_SESSION - assumed 'LOCALE_LANGUAGE_NEGOTIATION_SESSION' in locale_language_negotiation_info() (line 584 of /modules/locale/locale.module).
Notice: Use of undefined constant LOCALE_LANGUAGE_NEGOTIATION_USER - assumed 'LOCALE_LANGUAGE_NEGOTIATION_USER' in locale_language_negotiation_info() (line 597 of /modules/locale/locale.module).
Notice: Use of undefined constant LOCALE_LANGUAGE_NEGOTIATION_BROWSER - assumed 'LOCALE_LANGUAGE_NEGOTIATION_BROWSER' in locale_language_negotiation_info() (line 605 of /modules/locale/locale.module).
Notice: Use of undefined constant LOCALE_LANGUAGE_NEGOTIATION_INTERFACE - assumed 'LOCALE_LANGUAGE_NEGOTIATION_INTERFACE' in locale_language_negotiation_info() (line 614 of /modules/locale/locale.module).
Notice: Use of undefined constant LOCALE_LANGUAGE_NEGOTIATION_URL_FALLBACK - assumed 'LOCALE_LANGUAGE_NEGOTIATION_URL_FALLBACK' in locale_language_negotiation_info() (line 623 of /modules/locale/locale.module).

constants have been moved into locale.inc, so we should require it in locale_language_negotiation_info()

function locale_language_negotiation_info() {
 + require_once DRUPAL_ROOT . '/includes/locale.inc';
  $file = 'includes/locale.inc';
  $providers = array();

  $providers[LOCALE_LANGUAGE_NEGOTIATION_URL] = array(
    'types' => array(LANGUAGE_TYPE_CONTENT, LANGUAGE_TYPE_INTERFACE, LANGUAGE_TYPE_URL),
    'callbacks' => array(
      'language' => 'locale_language_from_url',
      'switcher' => 'locale_language_switcher_url',
      'url_rewrite' => 'locale_language_url_rewrite_url',
    ),
    'file' => $file,
    'weight' => -8,
    'name' => t('URL'),
    'description' => t('Determine the language from the URL (Path prefix or domain).'),
    'config' => 'admin/config/regional/language/configure/url',
  );

attached small fix

fortis’s picture

Status: Needs review » Closed (fixed)

seems it should be in separate issue, moved there https://www.drupal.org/node/2571711