Drupal core requires the masterminds/html5
library (see https://github.com/Masterminds/html5-php ). (Also see core/composer.json
)
The version constraint is ~2.1
in the core composer.json (so conceivably drupal can work with 2.1, 2.2, 2.3 etc)
The Drupal composer.lock
is locking this library at 2.1.2 which is about a year old. Since then, there have been a few bug fixes to the library. ( See https://github.com/Masterminds/html5-php/releases )
Now the Drupal amp module ( https://www.drupal.org/project/amp ) depends on the amp-library ( https://github.com/Lullabot/amp-library ) which in turn requires the masterminds/html5
library, except its version requirement is ^2.2.0
(because it needs a bug fix that happened on 2.2.0. Specifically the amp-library needed a bug fix for https://github.com/Masterminds/html5-php/issues/98 )
So the following sequence of commands wont work currently:
$ cd fresh-clone-of-drupal-8.2.x
$ composer install
$ composer require lullabot/amp
This will give a version constraint error. Drupal wants to lock masterminds/html5 at 2.1.2 but lullabot/amp
wants 2.2.0 or higher.
The workaround for this currently is:
$ cd fresh-clone-of-drupal-8.2.x
$ composer install
$ composer update masterminds/html5
$ composer require lullabot/amp
What this does, of course, is update the Drupal composer.lock file to use (currently latest) version 2.2.1 of the library because the versions constraints are satisfiable: Drupal wants ~2.1
and lullabot/amp
wants ^2.2.0
I've attached a .diff file for the changes that are requested for Drupal core.
Ideally, we don't want to have to use workarounds on this issue hence the requested change to Drupal core. Also it will be beneficial for Drupal core to move to a more recent, less buggy version of the library..
Interestingly the acquia lightning distribution already locks the 2.2.1 version of the library. See https://github.com/acquia/lightning/blob/c1b328bf87100a69e1c496677b74e49...
Comment | File | Size | Author |
---|---|---|---|
update_composer_lock_for_masterminds_html5.diff | 1.6 KB | sidharth_k | |
Comments
Comment #2
sidharth_k CreditAttribution: sidharth_k commentedComment #3
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedI think its safe to update the library. We introduced the lib in #2429363: Add HTML5-lib to Drupal 8 core for the filter system and for the testing system for #1333730: [Meta] PHP DOM (libxml2) misinterprets HTML5 but i found only one usage in core to far. Thats in Drupal\views\Views\StyleMappingTest
Comment #6
catchCommitted/pushed to 8.2.x and cherry-picked to 8.1.x. Thanks!
Comment #8
xjm