Dynamic property issue in ConfigEntityQuery with PHP 8.2

Created on 2 August 2023, 11 months ago
Updated 16 June 2024, 12 days ago

Problem/Motivation

Dynamic Properties are deprecated in PHP 8.2 (see: https://php.watch/versions/8.2/dynamic-properties-deprecated)

Steps to reproduce

Install module and replace some views, then visit a replaced view. You should see a warning message.

Proposed resolution

I have created a patch to fix this issue for the ConfigEntityQuery class.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

🇸🇪Sweden ordermind

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

Comments & Activities

  • Issue created by @ordermind
  • 🇮🇳India MukhtarM

    Not able to reproduce this issue in D10.1.1, php 8.2. I enabled the Text formats and editors and it is working fine.

  • 🇮🇳India dineshkumarbollu

    @ordermind

    Installed in Drupal 10.2 with 8.2 unable reproduce the issue, can you steps to reproduce the issue(if i am missing anything).

  • 🇺🇸United States mortona2k Seattle

    I have this message appearing. Config Views 2.1.1, PHP 8.2.

    The patch is simple, it just adds the property that it's complaining about. I can't test at the moment, but it looks like it will fix it.

    Deprecated function: Creation of dynamic property Drupal\config_views\Plugin\views\query\ConfigEntityQuery::$group_operator is deprecated in Drupal\config_views\Plugin\views\query\ConfigEntityQuery->execute() (line 106 of modules/contrib/config_views/src/Plugin/views/query/ConfigEntityQuery.php).
    
    Drupal\config_views\Plugin\views\query\ConfigEntityQuery->execute(Object) (Line: 1441)
    Drupal\views\ViewExecutable->execute(NULL) (Line: 1469)
    Drupal\views\ViewExecutable->render() (Line: 199)
    Drupal\views\Plugin\views\display\Page->execute() (Line: 1645)
    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: 859)
    Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 421)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
    Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627)
    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: 186)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    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: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->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: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    
  • 🇺🇸United States swirt Florida

    Confirmed: I am seeing the same error as mortona2k on Drupal 10.1 and php8.2

  • Status changed to RTBC 3 months ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 3 months ago
    1 pass
  • 🇺🇸United States nadavoid

    I applied the from comment number two, and it resolved the issue for me. Marking this RTBC, but feel free to change if there's more work to be done.

  • 🇦🇹Austria maxilein

    I am seeing the same error on D10.2.7 and php 8.3.
    And this patch fixed it.

Production build 0.69.0 2024