Problem/Motivation

I'm getting this error message on /admin/config/services/google-analytics under PHP 8.1.2:

Deprecated function: explode(): Passing null to parameter #2 ($string) of type string is deprecated in Drupal\google_analytics\Form\GoogleAnalyticsAdminSettingsForm->buildForm() (line 211 of modules/contrib/google_analytics/src/Form/GoogleAnalyticsAdminSettingsForm.php).

Steps to reproduce

Open /admin/config/services/google-analytics under PHP 8.1.2.

Proposed resolution

t.b.d.

Remaining tasks

fix

User interface changes

none

API changes

none

Data model changes

none

Comments

marcvangend created an issue. See original summary.

artem0793’s picture

Status: Active » Needs review
StatusFileSize
new773 bytes
patrickmichael’s picture

Google Analytics 4.0.0
I have applied patch in #2. The error message persists, and occurs 3 times each time admin/config/services/google-analytics is loaded

Deprecated function: explode(): Passing null to parameter #2 ($string) of type string is deprecated in Drupal\google_analytics\Form\GoogleAnalyticsAdminSettingsForm->buildForm() (line 211 of /web/modules/contrib/google_analytics/src/Form/GoogleAnalyticsAdminSettingsForm.php)

#0 //web/core/includes/bootstrap.inc(346): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 //web/modules/contrib/google_analytics/src/Form/GoogleAnalyticsAdminSettingsForm.php(211): explode()
#3 [internal function]: Drupal\google_analytics\Form\GoogleAnalyticsAdminSettingsForm->buildForm()
#4 //web/core/lib/Drupal/Core/Form/FormBuilder.php(531): call_user_func_array()
#5 //web/core/lib/Drupal/Core/Form/FormBuilder.php(278): Drupal\Core\Form\FormBuilder->retrieveForm()
#6 //web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#7 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#8 //web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#9 //web/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 //web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#11 //web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#12 //vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#13 //vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#14 //web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#15 //web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#16 //web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#17 //web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#18 //web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#19 //web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#20 //vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#21//web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#22 //web/index.php(19): Drupal\Core\DrupalKernel->handle()
#23 {main}
kfolsom’s picture

Patch #2 worked for me. PHP 8.1.6, MySQL 8.0.29, D9.3.14, Google Analytics module 4.0.0.

Christopher Riley’s picture

Patch corrected my issue.

simgui8’s picture

#2 works here too. Thanks

simgui8’s picture

Status: Needs review » Closed (duplicate)
simgui8’s picture

I have closed this issue because it is a duplicate of 3258588

3258588 covers this issue plus some more deprecation warning and is RTBC.