← Back to team overview

mahara-contributors team mailing list archive

[Bug 1964834] A change has been merged

 

Reviewed:  https://reviews.mahara.org/12512
Committed: https://git.mahara.org/mahara/mahara/commit/6518c483b3888ed47616d7f7e59b024315d3e0a3
Submitter: Robert Lyon (robertl@xxxxxxxxxxxxxxx)
Branch:    21.04_DEV

commit 6518c483b3888ed47616d7f7e59b024315d3e0a3
Author: Gold <gold@xxxxxxxxxxxxxxx>
Date:   Tue Mar 22 11:23:47 2022 +1300

Bug 1964834: behat on php 7.2 vs 7.4

This enabled patching of composer managed files.

To test:
Check the currect state of the implode() command:
grep implode external/vendor/behat/mink/src/Selector/Xpath/Escaper.php

Run 'make initcomposer'.  You should see new output like this:

- Applying patches for behat/mink
escaper.patch (Fix implode())

Run the grep command again and verify the glue is first in the list for
the implode() command.

Change-Id: I192eb8c3ac414738080109e016e0a3a7064a3735
Signed-off-by: Gold <gold@xxxxxxxxxxxxxxx>
(cherry picked from commit b5acfc1f3fa4f733ab55d6bb94d393e669bfe73e)

-- 
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 Committed
Status in Mahara 20.10 series:
  New
Status in Mahara 21.04 series:
  New
Status in Mahara 21.10 series:
  New
Status in Mahara 22.04 series:
  Fix Committed

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