- Issue created by @Nadim Hossain
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7last update
about 2 years ago Not currently mergeable. - last update
about 2 years ago 8 pass - last update
about 2 years ago 8 pass - 🇦🇺Australia Nadim Hossain
Created a merge request and also added this patch version to use it in the composer to avoid using the merge request diff directly.
- last update
about 2 years ago 8 pass - last update
about 2 years ago 8 pass - 🇦🇺Australia Nadim Hossain
Thanks for the review @matthew. I have update the merge request and adding a updated patch as well.
- last update
about 2 years ago 8 pass - 🇺🇸United States neclimdul Houston, TX
-
+++ b/src/KeyConfigOverrides.php @@ -86,7 +86,7 @@ class KeyConfigOverrides implements ConfigFactoryOverrideInterface { - $key_value = $storage->load($key_id)->getKeyValue(); + $key_value = $storage->load($key_id) ? $storage->load($key_id)->getKeyValue() : NULL;
This triggers two loads. It should be either something like:
$key = $storage->load($key_id); $key_value = $key ? $key->getKeyValue() : NULL;
Or if we can require PHP 8 the much easier to read:
$key_value = $storage($key_id)?->getKeyValue();
-
+++ b/src/Plugin/KeyProviderBase.php @@ -63,7 +63,7 @@ abstract class KeyProviderBase extends KeyPluginBase implements KeyProviderInter - elseif (strlen($key_value) - $options['visible_right'] > 0) { + elseif (!is_null($key_value) && strlen($key_value) - $options['visible_right'] > 0) {
The interface says this should only be a string. What's causing it to be null? Do you have a deeper trace so we can maybe fix the code that's not following the interface?
-
- 🇺🇸United States RoloDMonkey
i noticed this patch is still not in the latest release which is June 2024 and wondering why not? is there a problem?
- 🇺🇸United States rlhawk Seattle, Washington, United States
Yes, this is a partial duplicate of 🐛 Deprecated Function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\key\Plugin\KeyType\EncryptionKeyType->validateKeyValue() (line 124 of modules/contrib/key/src/Plugin/KeyType/EncryptionKeyType.php) Fixed . Let's focus this issue on the
Error: Call to a member function getKeyValue() on null
part of it. - First commit to issue fork.
- Status changed to Needs review
9 days ago 5:17am 9 September 2025 - First commit to issue fork.
-
japerry →
committed 89a5c406 on 8.x-1.x authored by
nadim hossain →
Issue #3385523: Error: Call to a member function getKeyValue() on null...
-
japerry →
committed 89a5c406 on 8.x-1.x authored by
nadim hossain →
Now that this issue is closed, please review the contribution record.
As a contributor, attribute any organization helped you, or if you volunteered your own time.
Maintainers, please credit people who helped resolve this issue.