Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Input value "media_oembed_control" contains a non-scalar value

Created on 29 May 2023, over 1 year ago
Updated 15 November 2023, about 1 year ago

Problem/Motivation

This module is broken in Drupal 10, due to a change in Symfony/HttpFoundation. When you add media_oembed_control to a field and try to use one of the options, instead of loading the Oembed you get the Drupal site loaded inside the iframe, with an error.

The Watchdog log has this message:

Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Input value "media_oembed_control" contains a non-scalar value. in Symfony\Component\HttpKernel\HttpKernel->handle() (line 81 of /var/www/html/landmarks/dev-site/vendor/symfony/http-kernel/HttpKernel.php).

Steps to reproduce

Try to use this module on a Drupal 10 site.

Proposed resolution

Update to work with Symfony 5.1.

Remaining tasks

The offending line is actually line 34 of src/Controller/OEmbedIframeController.php :

    $media_oembed_control = $request->query->get('media_oembed_control', NULL);

... based on https://github.com/symfony/symfony/pull/34363 , ->get() returns a string, but the media_oembed_control parameter is passing an array. I think with Symfony 5, this is no longer allowed.

The comments on the issue suggest you can substitute ->all() to get the same result:

    $media_oembed_control = $request->query->all('media_oembed_control', NULL);

This change is working for me on a new D10 site. I'm not sure whether it works on D8/9.

🐛 Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

🇺🇸United States freelock Seattle

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

Comments & Activities

Production build 0.71.5 2024