- Issue created by @Nadim Hossain
- Open on Drupal.org βCore: 9.5.x + Environment: PHP 8.0 & MySQL 5.7last update
about 1 year ago Not currently mergeable. - @nadim-hossain opened merge request.
- last update
about 1 year ago 8 pass - last update
about 1 year 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 1 year ago 8 pass - last update
about 1 year 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 1 year 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.