Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293174

Loading Media entities using the @MediaSource=oembed may trigger PHP exceptions if the referenced oEmbed URL does not comply with the spec

$
0
0

The setDimensions() method in class \Drupal\media\OEmbed\Resource throws an exception if image dimensions are not more than 0.

This causes the entity cache to fail whenever the offending media entity is included.

The issue has been observed when querying entities through the jsonapi. Whenever the media entity is included, either directly or via entity reference, the query is not cached.

For test data, consider Twitter oembeds, which do not follow the specifications.

The tweet
https://twitter.com/drupal/status/1123704931473678337
returns

url	https://twitter.com/drupal/status/1123704931473678337
author_name	Drupal
author_url	https://twitter.com/drupal
html	<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Drupal 8.7.0 has been released! Thanks to everyone who contributed to this version of <a href="https://twitter.com/hashtag/Drupal?src=hash&amp;ref_src=twsrc%5Etfw">#Drupal</a>. Find out what&#39;s new at <a href="https://t.co/1UXk30JrEJ">https://t.co/1UXk30JrEJ</a></p>&mdash; Drupal (@drupal) <a href="https://twitter.com/drupal/status/1123704931473678337?ref_src=twsrc%5Etfw">May 1, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
width	550
height	
type	rich
cache_age	3153600000
provider_name	Twitter
provider_url	https://twitter.com
version	1.0

which will throw an exception as the height is undefined.

Method in question:
https://api.drupal.org/api/drupal/core%21modules%21media%21src%21OEmbed%...


Viewing all articles
Browse latest Browse all 293174

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>