Problem/Motivation

If you leave "Changes" empty when updating Ts & Cs, due to Xss::filterAdmin running on the empty string, if you are running PHP 8.1 or above, you get the errors:

Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Component\Utility\Unicode::validateUtf8() (line 395 of core/lib/Drupal/Component/Utility/Unicode.php).

Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\Component\Utility\Xss::filter() (line 69 of core/lib/Drupal/Component/Utility/Xss.php).

Steps to reproduce

1. Update your terms of use with no changes
2. Go to the Ts & Cs page
3. Observe deprecation errors

Proposed resolution

Check if changes is empty before running the filter.

Remaining tasks

Fix the code.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork legal-3533658

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

littlepixiez created an issue. See original summary.

littlepixiez’s picture

Assigned: littlepixiez » Unassigned
Status: Active » Needs review

robert castelo made their first commit to this issue’s fork.

robert castelo’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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