Use drupal_static() instead of setting dynamic property on $config in ConfigEventsSubscriber

Created on 10 August 2023, over 1 year ago
Updated 21 August 2023, over 1 year ago

Compatibility issue between module version 2.1.1 and PHP version 8.2 in my project.
The error it was causing was this:

error:
Deprecated function: Creation of dynamic property Drupal\Core\Config\Config::$oembedProvidersProcessed is deprecated in Drupal\oembed_providers\EventSubscriber\ConfigEventsSubscriber->configSave() (line 82 of modules/contrib/oembed_providers/src/EventSubscriber/ConfigEventsSubscriber.php).
Drupal\oembed_providers\EventSubscriber\ConfigEventsSubscriber->configSave(Object, 'config.save', Object)
call_user_func(Array, Object, 'config.save', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'config.save') (Line: 229)
Drupal\Core\Config\Config->save(1) (Line: 278)
Drupal\Core\Config\Entity\ConfigEntityStorage->doSave('remote_audio', Object) (Line: 486)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 257)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 609)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 388)
Drupal\Core\Config\ConfigInstaller->createConfiguration('', Array) (Line: 259)
Drupal\Core\Config\ConfigInstaller->installOptionalConfig(Object, '') (Line: 163)
Drupal\Core\Config\ConfigInstaller->installDefaultConfig('module', 'media_remote_audio') (Line: 75)
Drupal\Core\ProxyClass\Config\ConfigInstaller->installDefaultConfig('module', 'media_remote_audio') (Line: 327)
Drupal\Core\Extension\ModuleInstaller->install(Array, 1) (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array) (Line: 502)
Drupal\system\Form\ModulesListForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('system_modules', 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: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 54)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->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)

The issue remains open due to possible future problems, as I haven't thoroughly checked that everything functions correctly with PHP version 8.2.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • PHP 8.2

    The issue particularly affects sites running on PHP version 8.2.0 or later.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024