Problem/Motivation

Error on language negotiation page (/admin/config/regional/language/detection) after clicking "Save settings" button.

Fatal error: Cannot access protected property Drupal\block\Entity\Block::$id in /home/s1a7d8dae28761cf/www/core/modules/language/src/Form/NegotiationConfigureForm.php on line 337

Proposed resolution

TBD

Remaining tasks

User interface changes

N/A

API changes

N/A

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug due to fatal error
Issue priority Major because this fatal error can be produced through the UI
Unfrozen changes Unfrozen because it only changes code to not throw a fatal error
Prioritized changes The main goal of this issue is a bug fix.

Comments

kristen pol’s picture

Issue summary: View changes
kristen pol’s picture

Issue summary: View changes
kristen pol’s picture

Issue summary: View changes
kristen pol’s picture

Issue summary: View changes
unstatu’s picture

Assigned: Unassigned » unstatu
unstatu’s picture

Assigned: unstatu » Unassigned

Cannot reproduce. Tried to get the error by doing some changes in the detection configuration, but I got no errors.

Steps followed:
1- Installed a standard Drupal 8
2- Enabled the Language module
3- Acceded to /admin/config/regional/language/detection
4- Enabled and disabled the detection methods randomly
5- Clicked to 'Save settings'

unstatu’s picture

Issue tags: +SprintWeekend2015
develcuy’s picture

Issue tags: -SprintWeekend2015Queue
develcuy’s picture

Issue tags: +SprintWeekend2015Queue

Removed SprintWeekend2015Queue by mistake.

kristen pol’s picture

This happened when I was testing a particular D8MI patch... let me see if I can figure out which one and can reproduce.

kristen pol’s picture

Status: Active » Closed (cannot reproduce)

I'm not able to find the patch I was testing that caused this to happen so closing this.

geertvd’s picture

Status: Closed (cannot reproduce) » Needs review
StatusFileSize
new794 bytes

I got the same error and found this issue.
This is caused by #2030571: Expand Block with methods which created getters and setters for the Black class and changed the public $id property to a protected one.
Simple fix: just call the getter instead of directly calling the property.

geertvd’s picture

Priority: Normal » Major

I think this can be a major

webchick’s picture

Issue tags: +Needs tests

Patch looks fine, but let's get an automated test so we don't accidentally re-introduce errors in this code path again.

geertvd’s picture

StatusFileSize
new1.92 KB
new2.67 KB

Added test and changed the original patch.
Instead of matching on id which is the block's machine name and configurable by the user I'm matching on the pluginId instead.

Status: Needs review » Needs work

The last submitted patch, 15: 2408977-15-complete.patch, failed testing.

The last submitted patch, 15: 2408977-15-test.patch, failed testing.

Status: Needs work » Needs review

geertvd queued 15: 2408977-15-complete.patch for re-testing.

geertvd queued 15: 2408977-15-test.patch for re-testing.

The last submitted patch, 15: 2408977-15-test.patch, failed testing.

jhedstrom’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

This now has tests illustrating the issue, and the fix.

I think the change to use the plugin ID makes sense, and the code is easier to understand.

I've updated the issue summary to include a beta phase evaluation.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Nice work. Committed ffea3bb and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation to the issue summary.

  • alexpott committed ffea3bb on 8.0.x
    Issue #2408977 by geertvd: Fatal error: Cannot access protected property...

Status: Fixed » Closed (fixed)

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