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...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sidharth_k created an issue. See original summary.

sidharth_k’s picture

Status: Active » Needs review
webflo’s picture

Status: Needs review » Reviewed & tested by the community

I 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

  • catch committed 4965a80 on 8.2.x
    Issue #2752645 by sidharth_k: Update masterminds/html5 dependency in...

  • catch committed 889f48d on 8.1.x
    Issue #2752645 by sidharth_k: Update masterminds/html5 dependency in...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.2.x and cherry-picked to 8.1.x. Thanks!

Status: Fixed » Closed (fixed)

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

xjm’s picture

Version: 8.2.x-dev » 8.1.x-dev