PHP 8.2: Dynamic Properties are deprecated

Created on 27 July 2023, about 1 year ago
Updated 18 August 2023, about 1 year ago

Problem/Motivation

Error message
Deprecated function: Creation of dynamic property Drupal\redirect_404\Plugin\views\field\Redirect404Operations::$currentUser is deprecated in Drupal\redirect_404\Plugin\views\field\Redirect404Operations->__construct() (line 56 of modules/contrib/redirect/modules/redirect_404/src/Plugin/views/field/Redirect404Operations.php).
Drupal\redirect_404\Plugin\views\field\Redirect404Operations->__construct(Array, 'redirect_404_operations', Array, Object, Object, Object) (Line: 63)
Drupal\redirect_404\Plugin\views\field\Redirect404Operations::create(Object, Array, 'redirect_404_operations', Array) (Line: 21)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('redirect_404_operations', Array) (Line: 76)
Drupal\Component\Plugin\PluginManagerBase->createInstance('redirect_404_operations', Array) (Line: 121)
Drupal\views\Plugin\ViewsHandlerManager->createInstance('redirect_404_operations', Array) (Line: 106)
Drupal\views\Plugin\ViewsHandlerManager->getHandler(Array, NULL) (Line: 900)
Drupal\views\Plugin\views\display\DisplayPluginBase->getHandlers('field') (Line: 1055)
Drupal\views\ViewExecutable->_initHandler('field', Array) (Line: 913)
Drupal\views\ViewExecutable->initHandlers() (Line: 2330)
Drupal\views\Plugin\views\display\DisplayPluginBase->preExecute() (Line: 1707)
Drupal\views\ViewExecutable->preExecute(Array) (Line: 1642)
Drupal\views\ViewExecutable->executeDisplay('page_1', Array) (Line: 81)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 377)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 171)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
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: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

install Redirect 8.x-1.8 in Drupal 10 with PHP 8.2

🐛 Bug report
Status

Closed: duplicate

Version

1.8

Component

Code

Created by

🇨🇦Canada gravityBites

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