Problem/Motivation

In PHP 8.1, calling the mb_strtolower() function with a null argument returns a deprecation error.

Deprecated function: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\block_exclude_pages\Plugin\Condition\BlockExcludePagesRequestPath->evaluate() (line 70 of block_exclude_pages/src/Plugin/Condition/BlockExcludePagesRequestPath.php)

Proposed resolution

We need to ensure the variable is not null.
$pages = mb_strtolower($this->configuration['pages'] ?? '');

Command icon 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

aimai created an issue. See original summary.

santanu mondal’s picture

Assigned: Unassigned » santanu mondal
santanu mondal’s picture

Assigned: santanu mondal » Unassigned
aimai’s picture

Status: Active » Needs review
benstallings’s picture

Status: Needs review » Reviewed & tested by the community

simple and elegant!

elc’s picture

This issue has not been released.

See follow up issue: #3583167: Bad release; 2.2.1 == 2.1.2

elc’s picture

Title: Deprecated function: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecatet » Deprecated function: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
Status: Reviewed & tested by the community » Fixed

This is fixed in 2.2.2. The 2.2.1 release is erroneously on the 2.1.x branch.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.