← Back to team overview

mahara-contributors team mailing list archive

[Bug 1964834] Re: behat on php 7.2 vs 7.4

 

** Changed in: mahara/22.04
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/1964834

Title:
  behat on php 7.2 vs 7.4

Status in Mahara:
  Fix Released
Status in Mahara 20.10 series:
  Fix Released
Status in Mahara 21.04 series:
  Fix Released
Status in Mahara 21.10 series:
  Fix Released
Status in Mahara 22.04 series:
  Fix Released

Bug description:
  In external/composer.json we have behat/mink nailed to a specific
  version. Moving this version will be time consuming as we quickly
  enter what I call 'dependency hell'.

  There are some elements that do not play well with php 7.4, e.g.
  implode() is now no longer flexible on the order of its attributes and
  throws an error.

  Edits to the files in external/vendor will be overwritten on the next
  'make initcomposer'.

  To resolve this I have the following suggestion;

  diff --git a/external/composer.json b/external/composer.json
  index 2cea1b26cb..384ed0234d 100644
  --- a/external/composer.json
  +++ b/external/composer.json
  @@ -11,12 +11,21 @@
           "guzzlehttp/guzzle": "^6.3.0",
           "phpunit/phpunit": "^8",
           "behat/mink-browserkit-driver": "1.3.3",
  -        "symfony/css-selector": "3.4.38"
  +        "symfony/css-selector": "3.4.38",
  +        "cweagans/composer-patches": "^1.7"
       },
   
       "autoload": {
           "psr-0": {
             "MaharaExtension": "../htdocs/testing/frameworks/behat/extension/"
           }
  +    },
  +    "config": {
  +        "allow-plugins": {
  +            "cweagans/composer-patches": true
  +        }
  +    },
  +    "extra": {
  +      "patches-file": "composer.patches.json"
       }
   }

  This will pull in cweagans/composer-patches, enable it, and set up
  composer.patches.json as the file that manages our tweaks to the stuff
  we're checking out.

  external/composer.patches.json:
  {
    "patches": {
      "behat/mink": {
        "Fix implode()": "escaper.patch"
      }
    }
  }

  This gives us a single patch file that we will use.

  external/escaper.patch:
  --- a/vendor/behat/mink/src/Selector/Xpath/Escaper.php   2022-03-15 10:30:18.902551052 +1300
  +++ b/vendor/behat/mink/src/Selector/Xpath/Escaper.php    2022-03-15 10:31:41.315406073 +1300
  @@ -47,6 +47,6 @@
               }
           }
   
  -        return sprintf('concat(%s)', implode($parts, ','));
  +        return sprintf('concat(%s)', implode(',', $parts));
       }
   }

  This fixes the implode() statement that causes issues on php 7.4.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1964834/+subscriptions



References