strlen(): Passing null to parameter #1 ($string) of type string is deprecated

Created on 16 January 2023, about 2 years ago

Problem/Motivation

When adding a new key, the following error is thrown, when running PHP 8.1+

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).

Steps to reproduce

Attempting to add a new key and submit the form at /admin/config/system/keys/add.

Type Settings

Key Type: Encryption

Key Size: 256

Provider Settings

Key Provider: Environment

Environment Variable: EXAMPLE_ENCRYPTION_KEY

Error can occur when:

  • The environment variable does not exist or it is empty.
  • The selected key size does not match the actual size of the key.

Proposed resolution

Do not pass NULL value as instructed in the error message.

πŸ› Bug report
Status

Closed: duplicate

Version

1.16

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Shefik

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Closed: duplicate about 2 years ago
Production build 0.71.5 2024