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.

Comments

freelock created an issue. See original summary.

lindsay.wils’s picture

Just tried this on D10 with the same issues. Your update fixes the issue. Any chance of a patch being released with this update?

Thanks in advance

lindsay.wils’s picture

Any update on a patch being created for this? This is unusable in D10.

Unfortunately I do not know how to create a patch, happy to try if there is a guide online somewhere?

Thanks

shailja179’s picture

Status: Active » Needs work
shailja179’s picture

StatusFileSize
new1.86 MB

I am not getting this error on Drupal 10. Embed video is playing with autoplay.
Give me steps for the error, i can provide the patch if there is issue.
See the screenshot.

matthiasm11’s picture

Title: Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Input value "media_oembed_control" contains a non-scalar value. » Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Input value "media_oembed_control" contains a non-scalar value
Status: Needs work » Needs review
StatusFileSize
new668 bytes

I had the same issue. The creator of issue https://www.drupal.org/project/media_oembed_control/issues/3388686 also had the same issue.

Attached patch.

jacobbell84’s picture

Is this patch backwards compatible with 8 and 9, or do we need to make a new Drupal 10 specific module release?

jacobbell84’s picture

Status: Needs review » Closed (outdated)
noah’s picture

Version: 2.0.0-beta2 » 2.0.0-beta4
Status: Closed (outdated) » Active

The fix for this appears to have been lost in the current beta—I'm seeing the error again, and src/Controller/OEmbedIframeController.php has regressed to $request->query->get('media_oembed_control', NULL). The patch from 6 still applies and fixes the problem.

The other fix from the patch at #3388686: Exception thrown when trying to render a remote video field has persisted, only this one appears to have regressed.

lamp5’s picture

Status: Active » Reviewed & tested by the community

Confirmed. It is regression from this issue #3380731: YouTube live videos won't autoplay due to missing "mute" url parameter. Patch #6 works.

  • jacobbell84 committed b7787421 on 2.x
    [#3363412] fix: Symfony\Component\HttpKernel\Exception\...
jacobbell84’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all! I re-merged the patch.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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