Problem/Motivation

Output of composer outdated -D
masterminds/html5 2.3.0 2.5.0 An HTML5 parser and serializer.
There is an API breakage from 2.3 -> 2.4 https://github.com/Masterminds/html5-php/compare/2.3.1...2.4.0#diff-7fce.... See #3032693-3: Update core PHP dependencies before 8.7.0 for more info.

Since 2.7.5 release PHP 8.1 support is added

Proposed resolution

Update the library, provide BC if possible and tests

Remaining tasks

Figure out BC plan

User interface changes

None

API changes

TBD

Data model changes

None

Release notes snippet

WIP

Comments

jibran created an issue. See original summary.

martin107’s picture

Title: Update masterminds/html5 to 2.5.0 » Update masterminds/html5 to 2.6.0

After a recent commit

Issue #3032693 by jibran, alexpott, chr.fritsch: Update core PHP dependencies before 8.7.0

I think we should set 2.6 as the target,

composer outdated -D
doctrine/annotations v1.2.7 v1.6.0 Docblock Annotations Parser
doctrine/common v2.6.2 v2.10.0 Common Library for Doctrine projects
masterminds/html5 2.3.0 2.6.0 An HTML5 parser and serializer.
paragonie/random_compat v2.0.18 v9.99.99 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7

martin107’s picture

StatusFileSize
new106.42 KB

I just want to see testbots response to just updating the core/composer.json

and then running composer install

martin107’s picture

Status: Active » Needs review
berdir’s picture

+++ b/core/composer.json
@@ -41,7 +41,7 @@
         "egulias/email-validator": "^2.0",
-        "masterminds/html5": "^2.1",
+        "masterminds/html5": "^2.6",
         "symfony/psr-http-message-bridge": "^1.0",

we should only update the lock file, because this is going to conflict with the amp module and break all sites using that.

you should also only run compoesr update masterminds/html5, and not update everything.

Status: Needs review » Needs work

The last submitted patch, 3: 3040037-3.patch, failed testing. View results

martin107’s picture

Status: Needs work » Needs review
StatusFileSize
new2.67 KB

thank you.

so starting from a fresh checkout the result of

composer update masterminds/html5
martin107’s picture

Please excuse my paranoia. -- did that actually run the test-suites with the updated packages ?

Here is the line that gives me confidence to say YES.

- Updating masterminds/html5 (2.3.0 => 2.6.0): As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.

in full context this.

https://dispatcher.drupalci.org/job/drupal_patches/90012/consoleText

---------------- Starting update_dependencies ----------------
Directory created at /var/lib/drupalci/workspace/jenkins-drupal_patches-90012/ancillary/update_dependencies
core dependencies changed by patch: recalculating depenendices
Composer Command: sudo -u www-data /usr/local/bin/composer install --prefer-dist --no-suggest --no-interaction --no-progress --working-dir /var/www/html
sudo -u www-data /usr/local/bin/composer install --prefer-dist --no-suggest --no-interaction --no-progress --working-dir /var/www/html
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 0 installs, 1 update, 0 removals
- Updating masterminds/html5 (2.3.0 => 2.6.0): As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Installing 'unzip' may remediate them.
Downloading (100%)
> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files

martin107’s picture

We should only update the lock file, because this is going to conflict with the amp module and break all sites using that.

Question : Where in core do we use Masterminds/html5 ?

Answer: StyleTestBase::storePreview(), an method in a abstract class.

The classes that extend StyleTestBase, StyleUnformattedTest and StyleMappingTest both use it,

So being constructive .. to best way to fix it is to decouple the amp's hidden dependency on core definition of the package.. and move core's dependency down into the 'require-dev' section of composer.json

so here is my todo list:

a) So this change should be marked as Drupal9
b) The amp module can be corrected today?
c) A change record produced to signal to all other contrib modules that the mastermind/html5 package is moving to require-dev

@Bedir - Do I have that correct?

martin107’s picture

just looking into the question of breaking the amp module(#5)

I have not used amp , so I am not the person to comment, but

when I pull in the amp dev branch with

composer require 'drupal/amp:2.x-dev'

I don't see a dependency on masterminds/html5 - hidden or otherwise.

berdir’s picture

> I don't see a dependency on masterminds/html5 - hidden or otherwise.

It's an indirect dependency, drupal/amp depends on lullabot/amp and that has "masterminds/html5": "~2.3.0",

And the problem with moving it to require-dev wouldn't really solve it as anyone who installs with dev dependencies would still have a conflict. But still interesting that we only need it in tests..

wim leers’s picture

#9: The intent was always to use masterminds/html5 instead of PHP's native \DOMDocument. Because \Drupal\Component\Utility\Html::load() today is NOT HTML5-compliant. See #1333730: [Meta] PHP DOM (libxml2) misinterprets HTML5.

EDIT: and yes, that means it still has not happened :(

martin107’s picture

thanks for providing the wider perspective.... it is alway useful.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

berdir’s picture

See #3088369-14: Update Drupal 9 to Symfony 4.4-dev, the patch now updates masterminds/html5 in 9.0.x to be able to update all symfony components to 4.4.

Not sure if we should just close this issue as a duplicate or keep it for 8.9.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

alexpott’s picture

Version: 9.1.x-dev » 8.9.x-dev
+++ b/composer.lock
@@ -976,31 +976,33 @@
+                "ext-ctype": "*",

This is introducing an extension dependency we've not had before.

alexpott’s picture

AH but we have symfony's polyfills to the rescue - we already depend on symfony/polyfill-ctype

longwave’s picture

Presumably too late for this to happen in 8.9.x now, I think this should be closed as won't fix.

berdir’s picture

Status: Needs review » Closed (duplicate)

Agreed, lets just close it, if someone disagrees strongly they can reopen.

The amp 3.x module has been updated now to be compatible with more recent versions, so sites can update if they want to. Well, as long as they don't use drupal/core-recommended, that is.

andypost’s picture

Title: Update masterminds/html5 to 2.6.0 » Update masterminds/html5 to 2.7.5
Version: 8.9.x-dev » 9.3.x-dev
Issue summary: View changes
Status: Closed (duplicate) » Needs work
andypost’s picture

Issue tags: +PHP 8.1
andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new2.44 KB
alexpott’s picture

Version: 9.3.x-dev » 8.9.x-dev
Status: Needs review » Closed (duplicate)
Issue tags: -PHP 8.1

@andypost this is a duplicate of #3224000: Update dependencies for Drupal 9.3