PHP Fatal error: Cannot redeclare Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant::id()

Created on 4 July 2024, 2 months ago
Updated 8 July 2024, 2 months ago

Every time composer updates, website errors out with the following:

PHP Fatal error: Cannot redeclare Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant::id() in C:\[...]\modules\contrib\panels\src\Plugin\DisplayVariant\PanelsDisplayVariant.php on line 582

At the bottom of said file, this function appears twice:

public function id() {
    // Explicit IPE/Panelizer Support.
    if (!empty($this->getContexts()['@panelizer.entity_context:entity']) && $this->getContexts()['@panelizer.entity_context:entity']->hasContextValue()) {
      return $this->getContexts()['@panelizer.entity_context:entity']->getContextValue()->uuid();
    }
    // If the panelizer context isn't available, just return our uuid.
    return parent::id();
  }

  public function id() {
    // Explicit IPE/Panelizer Support.
    if (!empty($this->getContexts()['@panelizer.entity_context:entity']) && $this->getContexts()['@panelizer.entity_context:entity']->hasContextValue()) {
      return $this->getContexts()['@panelizer.entity_context:entity']->getContextValue()->uuid();
    }
    // If the panelizer context isn't available, just return our uuid.
    return parent::id();
  }

I have to manually comment out the second declaration every time, which fixes the error until the next update, then it comes back.

🐛 Bug report
Status

RTBC

Version

4.8

Component

Code

Created by

🇨🇦Canada sharchun

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to RTBC 2 months ago
  • 🇮🇳India chaitanyadessai

    Installed panels version 8.x-4.8 on drupal 10.3.1, executed composer update command, no duplicate function id() got added.

Production build 0.71.5 2024