Problem/Motivation
When loading local pages that call stage file proxy a warning is thrown as NULL is being passed to a trim function.
Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\stage_file_proxy\EventSubscriber\StageFileProxySubscriber->checkFileOrigin() (line 135 of modules/contrib/stage_file_proxy/src/EventSubscriber/StageFileProxySubscriber.php).
Drupal\stage_file_proxy\EventSubscriber\StageFileProxySubscriber->checkFileOrigin(Object, 'kernel.request', Object)
call_user_func(Array, Object, 'kernel.request', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.request') (Line: 142)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 70)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
First instance was fixed as part of
https://www.drupal.org/project/stage_file_proxy/issues/3293275 →
However, there is another instance in StageFileProxySubscriber.php
class as well.
I think we should address that as well.
Steps to reproduce
Use PHP 8.1
Use a version of the site connected via stage file proxy
Load a page with lots of files to get
Warnings are displayed
Proposed resolution
Similar changes to what we did in
https://www.drupal.org/project/stage_file_proxy/issues/3293275 →
Remaining tasks
Uploading the patch.
Needs review for the patch.
User interface changes
N/A
API changes
N/A
Data model changes
N/a