Bug Arr::stringToArray doesn't handle nulls gracefully

There is a bug in this version
X

Xon

Guest
The Arr::stringToArray is used on potentially nullable inputs, but trim requires non-null inputs as of php 8.1


An example of triggering this is;
PHP:

Code:
                    /** @var \XF\Entity\ChangeLog $changeLog */
                    $changeLog = \XF::em()->create('XF:ChangeLog');
                    $changeLog->content_type = 'user';
                    $changeLog->content_id = 1;
//                    $changeLog->old_value = '';
                    $changeLog->new_value =...

Read more

Continue reading...
 
PHP:
/** @var \XF\Entity\ChangeLog $changeLog */
$changeLog = \XF::em()->create('XF:ChangeLog');
$changeLog->content_type = 'user';
$changeLog->content_id = 1;
$oldValue = $changeLog->old_value ?? '';
$changeLog->new_value = trim($oldValue);

Here are some changes to your code. Can you tell if it will work or not?