Problem/Motivation

Installed the new 2.3.0-alpha8 version on a fresh D10 installation and on /admin/config and /admin/reports is it throwing the following error:

AssertionError: Cannot load the "key" entity with NULL ID. in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).

No key entity has yet been created in the Key module and configured in the DeepL providers in TMGMT. The alpha8 version contains a change in getTranslator() where it does a strict comparison on the $key_id:

if ($key_id !== '') {

}

This statement let null, 0, '0' etc. pass as they are not empty strings and then we have the error and no option to configure the missing key from the UI.

UPDATE: The issue also exist twice in DeeplMultilingualGlossaryApi.

Steps to reproduce

  1. Prepare a fresh D10/D11 installation
  2. Install tmgmt_deepl 2.3.0-alpha8 and other required modules.
  3. Navigate to /admin/config or /admin/reports

Proposed resolution

Change the strict comparison from:

if ($key_id !== '') {

}

to

if (is_string($key_id) && $key_id !== '') {

}
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

beltofte created an issue. See original summary.

beltofte’s picture

Issue summary: View changes
steffenr’s picture

Hi beltofte - that's a good catch. Thanks for the finding.
Can you create a MR fixing those issues - this would be really helpful..

beltofte’s picture

Hi steffenr,

The MR is open now. Managed to screw up and commit to the wrong branch, so took a few more minutes to have the MR ready.

beltofte’s picture

Status: Active » Needs review

  • beltofte committed 827ae98d on 2.3.x
    fix: #3594215 AssertionError: Cannot load the "key" entity with NULL ID.
steffenr’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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