Deprecated function: Creation of dynamic property Drupal\linkchecker\Form\LinkCheckerAdminSettingsForm::$moduleHandler is deprecated

Created on 29 July 2024, 6 months ago

Problem/Motivation

Starting in PHP 8.2, dynamic properties are deprecated.

Exception: Deprecated function: Creation of dynamic property Drupal\linkchecker\Form\LinkCheckerAdminSettingsForm::$moduleHandler is deprecated Drupal\linkchecker\Form\LinkCheckerAdminSettingsForm->__construct()() (Line: 96)

Steps to reproduce

Proposed resolution

Declare the property in the LinkCheckerAdminSettingsForm class.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States collinhaines

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

Comments & Activities

  • Issue created by @collinhaines
  • Status changed to Needs review 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States collinhaines
  • Status changed to Closed: duplicate 6 months ago
  • πŸ‡ΊπŸ‡¦Ukraine quadrexdev Lutsk

    Thanks for reporting, this one was already resolved within this issue - https://www.drupal.org/project/linkchecker/issues/3465025 πŸ“Œ Fix cspell, upgrade status and phpstan issues Fixed

  • Hello,

    Drupal: 10.4.1
    PHP: 8.2.24
    MySQL: 8.0.36

    I just installed this module and after saving the configuration file, i got this error
    Deprecated function: Creation of dynamic property Drupal\linkchecker\Form\LinkCheckerAdminSettingsForm::$moduleHandler is deprecated in Drupal\linkchecker\Form\LinkCheckerAdminSettingsForm->__construct() (line 96 of modules/contrib/linkchecker/src/Form/LinkCheckerAdminSettingsForm.php).

    I have applied the patch shared by post #2
    a) downloaded and added to my 'patches' folder

    b) adjusted the composer.json file to add the entry under "extra"

                "drupal/linkchecker": {
                    "Fixes Error: Deprecated function: Creation of dynamic property": "patches/linkchecker--creation-of-dynamic-property-module-handler--3464481.patch"
                }

    c) after that, run composer install

    , but I'm still having the same issue

    Drupal\linkchecker\Form\LinkCheckerAdminSettingsForm->__construct() (Line: 104)
    Drupal\linkchecker\Form\LinkCheckerAdminSettingsForm::create() (Line: 41)
    Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (Line: 48)
    Drupal\Core\Controller\HtmlFormController->getFormObject() (Line: 58)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

    Am I missing something?

Production build 0.71.5 2024