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
- Prepare a fresh D10/D11 installation
- Install tmgmt_deepl 2.3.0-alpha8 and other required modules.
- 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 !== '') {
}
Issue fork tmgmt_deepl-3594215
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
Comment #2
beltofteComment #3
steffenrHi beltofte - that's a good catch. Thanks for the finding.
Can you create a MR fixing those issues - this would be really helpful..
Comment #5
beltofteHi 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.
Comment #6
beltofteComment #8
steffenr