strlen(): Passing null to parameter #1 when using PHP 8.1

Created on 4 January 2024, 6 months ago
Updated 5 January 2024, 6 months ago

Problem/Motivation

Getting below warning when viewing the user page
Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in username_policy_form_alter() (line 58 of /username_policy/username_policy.module)

Steps to reproduce

Drupal version: 10.2.0
PHP Version : 8.1.26

1. Install module
2. Configure pattern for username
3. Create a new user without a username.
4. Visit the user landing page.
5. Check the Recent log messages

Proposed resolution

Put !empty in if condition and verify the changes.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇮🇳India sourabhjain

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024