Chainflix OEmbed endpoint breaks regex matching

Created on 3 January 2022, over 3 years ago
Updated 24 April 2025, about 12 hours ago

Problem/Motivation

Tests started failing with the following error:
preg_match(): Unknown modifier 'w'

With the stacktrace

/data/app/core/modules/media/src/OEmbed/Endpoint.php:155
/data/app/core/modules/media/src/OEmbed/UrlResolver.php:135
/data/app/core/modules/media/src/OEmbed/UrlResolver.php:167
/data/app/core/modules/media/src/Plugin/media/Source/OEmbed.php:246
/data/app/core/modules/media/src/Entity/Media.php:258
/data/app/core/modules/media/src/Entity/Media.php:156
/data/app/core/modules/media/src/Entity/Media.php:392
/data/app/core/modules/media/src/MediaStorage.php:27
/data/app/core/lib/Drupal/Core/Entity/EntityBase.php:339
/data/app/profiles/custom/my_profile/tests/src/MediaTestTrait.php:146

Where line 146 is saving a video media entity.

This is caused by Chainflix having endpoints https://(m|www).chainflix.net/video/?* and https://(m|www).chainflix.net/video/embed/?*

The regex in matchUrl uses pipe characters as the regex delimiters.

Steps to reproduce

Save a new video media entity

Proposed resolution

Fix the regex replacement in \Drupal\media\OEmbed\Endpoint::matchUrl

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component

media system

Created by

🇦🇺Australia acbramley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024