Problem/Motivation

When makes changes to the languages (more specificially changing the language negotiation) in Drupal 8.6.2 I'm getting multiple notices. Check out the screenshot for the error.

This is an error after using the Drupal 8.6.2 environment for a couple of weeks. This means the error could happen for a variety of reasons.
The fix I'm proposing is a simple check for the index, which is mostly harmless, but will remove the notice.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

Omirr85 created an issue. See original summary.

Omirr85’s picture

I'm attaching my proposed patch to fix this problem.
This is an index check in two files.

Omirr85’s picture

Issue summary: View changes
Omirr85’s picture

Title: Lanuage negotiation Notice undefined index » Lanuage negotiation notice: undefined index in getLangcode
Omirr85’s picture

StatusFileSize
new1.71 KB

Version: 8.6.2 » 8.6.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Version: 8.6.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Branches prior to 8.8.x are not supported, and Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

johankleene’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Bug Smash Initiative

Is this still an issue? I am trying to reproduce the problem, but don't see any errors. Can you describe how to reproduce it?

Version: 9.2.x-dev » 9.3.x-dev
willeaton’s picture

I am getting this same problem. When debugging all I see is in $config is this:

array (
  'domains' => 
  array (
    'es' => 'local.domain.com',
    'en' => 'local.domain.com',
    'fr' => 'local.domain.fr',
    'de' => 'local.domain.de',
    'pt-pt' => 'local.domain.pt',
  ),
)

I have a feeling its a bad configuration in the language.negotiation configuration but not sure what I have wrong. According to the notice I am missing "source"

willeaton’s picture

OK, I think I know whats happening here. I have the domain module installed and the language.negotiation.yml file (and config page) gets replaced with domain.config.DOMAIN_NAME.language.negotiation.yml however this notice comes about because the language.negotiation is being called and getting incomplete data. What I did was copy the domain.config.DOMAIN_NAME.language.negotiation.yml file into language.negotiation.yml and do a `drush cim` and it resolved it for me. No need for patches

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

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

In #9, it was reported that this problem is not reproducible. Then in #11, the problem was found when using the the Domain module and a workaround is given in #12. This is not looking like a problem in core.

If anyone is having this problem, re-open this issue and provide steps to reproduce starting from install Drupal core.

Thanks.

rory downes’s picture

Hi,
I have seen this issue with a Drupal 10.4.3 site. I don't have the domain module. It happens when I add a language and Drupal is going through the batch process of adding translations.

I also tried it on a vanilla Drupal site (10.4.4) with just admin_toolbar and key modules added and the issue does not occur. So perhaps one of the many modules that I am using cause this.

To get going for now with dev work I used the patch on comment 5 but had to improve on it as there are more places where $config['source'] is checked. I am not saying this is the solution but may help others in their dev environment add a language.

Regards Rory

rory downes’s picture

Status: Closed (outdated) » Active
rory downes’s picture

Version: 9.4.x-dev » 10.4.x-dev
quietone’s picture

Version: 10.4.x-dev » 11.x-dev
Assigned: Omirr85 » Unassigned
Issue summary: View changes
Issue tags: +Needs steps to reproduce

If this problem was discovered on a version of Drupal that is not 11.x, add that information in the issue summary and leave the version at 11.x. In Drupal core changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies. Also mentioned on the version section of the list of issue fields documentation.

I restored the standard template to make it easier to track progress here.

ishani patel’s picture

I've tested with D10.4.5 and D11.1.6 ,checked with adding new language also checked with already added language edit page but not reproduced this error.

Thank you!

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.