Drupal 10 compatibility fixes/ update dependencies for PHP 8.x support

Created on 10 May 2023, over 1 year ago
Updated 29 August 2024, 3 months ago

Problem/Motivation

Installing this on a site running PHP 8.1 fails due to this requirement: "php": ">=7.1.0"

Steps to reproduce

  1. Set up a site using PHP 8.1
  2. Run composer install drupal/web_page_archive
  3. Install fails with the errors listed below

Problem 1
    - spatie/browsershot[3.26.0, ..., 3.26.3] require php ^7.1 -> your php version (8.1.18) does not satisfy that requirement.
    - drupal/web_page_archive[1.0.0, 2.0.0, ..., 2.12.0] require drupal/core ^8 -> found drupal/core[8.0.0, ..., 8.9.20] but these were not loaded, likely because it conflicts with another require.
    - drupal/accessibility_scanner 2.0.0-beta1 requires drupal/web_page_archive * -> satisfiable by drupal/web_page_archive[1.0.0, 2.0.0, ..., 2.15.0, 4.0.0, ..., 4.1.1].
    - drupal/web_page_archive[2.13.0, ..., 2.15.0, 4.0.0, ..., 4.1.1] require spatie/browsershot ~3.26.0 -> satisfiable by spatie/browsershot[3.26.0, 3.26.1, 3.26.2, 3.26.3].
    - Root composer.json requires drupal/accessibility_scanner ^2.0@beta -> satisfiable by drupal/accessibility_scanner[2.0.0-beta1].

Proposed resolution

  • Update composer dependencies to allow use on PHP 8
  • Update any other composer dependencies as needed
📌 Task
Status

Fixed

Version

4.0

Component

Web Page Archive Base Module

Created by

🇬🇧United Kingdom psebborn

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @psebborn
  • 🇮🇳India dineshkumarbollu

    In PHP 8.1 i am getting error with composer install drupal/web_page_archive,
    I update the php version in composer.json file please Review and test.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.4 + Environment: php8.3_mysql8
    last update 11 months ago
    Composer require failure
  • Status changed to Needs work 6 months ago
  • 🇬🇧United Kingdom pobster

    I don't feel like we should be supporting PHP7.x any more, it's well beyond EOL now, as is PHP8.0.

    https://www.php.net/supported-versions.php

  • First commit to issue fork.
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • Status changed to Needs work 3 months ago
  • 🇹🇷Turkey orkut murat yılmaz Istanbul

    Thanks for your contribution @the_g_bomb.

    When I try to enable the module, after applying your commits as a patch, I receive the error message below:

    Class "Symfony\Component\EventDispatcher\Event" not found

  • 🇬🇧United Kingdom the_g_bomb

    Confirmed. I tried to get things in place, node etc to get the module fully working and ran into difficulties as well.

    I have a fix in place locally and will push asap.

    I suspect the fix I have in place may also fix: 🐛 Drupal 10 compatibility fixes Needs review

  • Status changed to Needs review 3 months ago
  • 🇬🇧United Kingdom the_g_bomb

    I have replaced
    use Symfony\Component\EventDispatcher\EventSubscriberInterface;
    with
    use Drupal\Component\EventDispatcher\EventSubscriberInterface;

    Which should fix the issue you were facing @orkut-murat-yılmaz

  • Status changed to Needs work 3 months ago
  • 🇬🇧United Kingdom pobster

    I linked to https://www.drupal.org/project/drupal/issues/3055198 📌 [Symfony 5] Symfony/Component/EventDispatcher/Event is deprecated in Symfony 4.3 use Symfony/Contracts/EventDispatcher/Event instead Fixed in https://www.drupal.org/project/web_page_archive/issues/3446369#comment-1... 🐛 Drupal 10 compatibility fixes Needs review

    This is the fix for the deprecation, I'm not sure why you both ignored my comment.

    Also, you might want to drop support for D9 in this. I very much doubt this maintains compatibility.

  • 🇬🇧United Kingdom pobster
  • 🇬🇧United Kingdom the_g_bomb

    Sorry, I didn't remove D9 support as I didn't think it was in the scope of the ticket, happy to update.

    Also didn't ignore your comment, I did a find and replace on "Symfony\Component\EventDispatcher\" to replace it with "Drupal\Component\EventDispatcher\".

    I must have missed that it replaced both Symfony\Component\EventDispatcher\Event as well as the instances of Symfony\Component\EventDispatcher\EventDispatcherInterface;

    The Interfaces have been reverted.

    I also removed D9 support and found another issue which I also fixed.

  • 🇬🇧United Kingdom pobster

    No need for sorry! D9 is unsupported now, so there's no need to accommodate "backwards-compatible" functionalities. I'm pretty sure we're breaking D9 compatibility with some of these changes anyway ... and with that in mind, my turn for a "sorry" - sorry ... but I think maybe I'm not being clear at all with my post above.

    94x: Symfony\Component\EventDispatcher\Event is deprecated in drupal:9.1.0 and will be replaced by Symfony\Contracts\EventDispatcher\Event in drupal:10.0.0. A new Drupal\Component\EventDispatcher\Event class is available to bridge the two versions of the class. See https://www.drupal.org/node/3159012

    There's no need to use \Drupal\Component\EventDispatcher\Event at all - if anything, it's more likely to be removed given it's bridging a deprecation for an older version of D9 (which as I say, is no longer supported by a VERY long way).

    I was trying to say, don't use the Drupal one - you should just use the \Symfony\Contracts\EventDispatcher\Event class instead.

  • 🇹🇷Turkey orkut murat yılmaz Istanbul

    I misunderstood your comment #3 @pobster, but it is more clear for me now.

  • 🇬🇧United Kingdom the_g_bomb

    Done, thanks for the pointers.

  • Status changed to Fixed 3 months ago
  • 🇬🇧United Kingdom pobster
  • 🇹🇷Turkey orkut murat yılmaz Istanbul

    @pobster, thanks for the merge:)

    can we consider merging with the 4.1.1 release and publish it on the module project's page too?

    best,
    Orkut

  • Status changed to Fixed 3 months ago
  • 🇬🇧United Kingdom pobster

    can we consider merging with the 4.1.1 release and publish it on the module project's page too?

    I've tagged it for 4.1.2, but no - I won't publish it on the modules project page. This module isn't supported anymore; it is marked as "Seeking new maintainer"/ "No further development" as I don't work for Rackspace anymore and have no interest in maintaining it.

Production build 0.71.5 2024