Deprecated function trim() passing null in PHP 8

Created on 6 November 2023, about 1 year ago
Updated 23 April 2024, 9 months ago

Problem/Motivation

There is a deprecated function message when saving the configuration.

Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\microsoft_clarity\Form\SettingsForm->validateForm() (line 154 of modules/contrib/microsoft_clarity/src/Form/SettingsForm.php).
Drupal\microsoft_clarity\Form\SettingsForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'microsoft_clarity_admin_settings') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('microsoft_clarity_admin_settings', Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('microsoft_clarity_admin_settings', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->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: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Enable the module. Go to the configuration page and enter a Project ID. Save the configuration. Deprecated function message appears.

The PHP version this happened on was 8.1.25.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇺🇸United States TheLioness22 Charlotte, NC

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024