Problem/Motivation

We recently checked a codebase containing Config Distro for PHP 7.4 compatibility using the PHPCompatibility Coding Standard for PHP CodeSniffer.

The following problem was detected within Config Distro:

FILE: /app/web/modules/contrib/config_distro/modules/config_distro_ignore/src/Controller/ConfigDistroIgnoreController.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 26 | ERROR | Using "parent" inside a class without parent is deprecated since PHP 7.4
-------------------------------------------------------------------------------------------------------------------------

Proposed resolution

It looks to me like this class is meant to extend Drupal\config\Controller\ConfigController like ConfigDistroController does.

Remaining tasks

Create patch that adds parent class to ConfigDistroIgnoreController.

CommentFileSizeAuthor
#5 3199197-5.patch1009 bytesnginex
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joegraduate created an issue. See original summary.

joegraduate’s picture

Assigned: joegraduate » Unassigned
Status: Active » Needs review
bircher’s picture

Status: Needs review » Needs work

Hmm, that seems broken.
So rather than add code through inheritance it would be good to check if this class is needed at all, and remove it if not. I don't have an ide handy right now but my first impression is that this is dead code that was left over from some initial development.
Thanks for finding it and thanks for using the module.

nginex’s picture

Status: Needs work » Needs review
StatusFileSize
new1009 bytes
joegraduate’s picture

Thanks @nginex for the more complete patch.

I checked and ConfigDistroIgnoreController does not appear to be used anywhere so I updated the MR to delete the file entirely as suggested by @bircher instead of modify it.

joegraduate’s picture

FWIW, we've been using the diff from this MR as a patch on a large number of sites that actively use Config Distro for some time now and have not seen any problems.

lluvigne’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +PHP 8.1

Hi! I'm checking code compatibility with PHP 8 for a site containing config distro and found the same error.

As @bircher sais in #4 seems to be something left over as the class is not being used anywhere. Removing the class doesn't break anything. Moving the issue to RTBC.

joegraduate’s picture

Version: 8.x-1.x-dev » 2.0.x-dev

  • joegraduate committed 19d9c718 on 2.0.x
    Issue #3199197 by joegraduate, nginex, bircher, lluvigne:...
joegraduate’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.