Fatal error on pages using using magnific popup formatter

Created on 4 July 2024, 6 months ago

Problem/Motivation

I'm in the process of upgrading to Drupal 10. I am running Drupal 9.5.11, PHP version 8.1.27, and was running magnific popup 1.5.
After upgrading the module to version 2.0.0, I get the following error on node pages view + administrative Manage Display pages that have the magnific popup formatter:
Fatal error: Declaration of Drupal\magnific_popup\Plugin\Field\FieldFormatter\MagnificPopupMedia::viewElements(Drupal\Core\Field\FieldItemListInterface $items, $langcode) must be compatible with Drupal\magnific_popup\Plugin\Field\FieldFormatter\MagnificPopup::viewElements(Drupal\Core\Field\FieldItemListInterface $items, $langcode): array in /var/www/html/web/modules/contrib/magnific_popup/src/Plugin/Field/FieldFormatter/MagnificPopupMedia.php on line 48

Steps to reproduce

Upgrade the module to version 2.0.0 and access view pages that use the formatter oand/or the Manage Display for entities that use the magnific popup.

Proposed resolution

Make the viewElements method in web/modules/contrib/magnific_popup/src/Plugin/Field/FieldFormatter/MagnificPopupMedia.php match the parent. In this case, the array return is not present in the child class. Or, remove the array return in the parent.

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

🐛 Bug report
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇷🇴Romania bbu23

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

Comments & Activities

Production build 0.71.5 2024