As of #3231731: Use Content-Type header from oEmbed thumbnail GET request when determining the file extension, the protected method \Drupal\media\Plugin\media\Source\OEmbed::getThumbnailFileExtensionFromUrl()
expects to be passed an instance of \Psr\Http\Message\ResponseInterface
. In the base implementation, the response's headers may be used to determine the thumbnail's file type.
For backwards compatibility, the base class currently allows the $response parameter to be NULL; if it is, and the thumbnail's file extension is not in the thumbnail's URL, the method will return NULL. However, passing NULL for the $response parameter is deprecated, and it will be a required parameter in Drupal 10.
To prevent PHP warnings, subclasses of \Drupal\media\Plugin\media\Source\OEmbed
which override the getThumbnailFileExtensionFromUrl()
method should adjust their code accordingly:
Before
protected function getThumbnailFileExtensionFromUrl(string $thumbnail_url): ?string {
// Do magic...
}
Now
use Psr\Http\Message\ResponseInterface;
protected function getThumbnailFileExtensionFromUrl(string $thumbnail_url, ResponseInterface $response = NULL): ?string {
// Do magic...
}