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.
Comments
Comment #3
littlepixiez commentedComment #6
robert castelo commented