- πΊπΈUnited States smustgrave
@phenaproxima I like the idea personally as it seems to be addressing the root cause. Wonder if you'll be able to reuse the test case though.
Media bundles allow for source values to be mapped to fields on the bundle. The mapping is executed in Drupal\media\Entity\Media::prepareSave
. There is an issue with how URLs are processed. Sometimes the metadata value is a string. Other times it is a \Drupal\Core\Url
object. When the mapped value is saved, the assumption is that the value is a string. Take a look at Drupal\media\OEmbed\Resource::getAuthorUrl
. This method calls Drupal\Core\URL::fromUri
, which expects to receive a string. If it receives a URL object, then the result is a fatal error.
Recoverable fatal error: Object of class Drupal\\Core\\Url could not be converted to string in /app/web/core/lib/Drupal/Core/Url.php on line 281
If the mapped field is a text field, then then the result is a different fatal error:
Or the following error for a Text field: <code> Uncaught PHP Exception Drupal\\Core\\Entity\\EntityStorageException: "Expected argument of type "string", "Drupal\\Core\\Url" given" at /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php line 847
Drupal\media\Entity\Media::prepareSave
can check if a particular metadata is a URL object. If so, convert the object to a string before saving.
Community review.
None.
None.
None.
None.
Needs work
10.1 β¨
Last updated
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
@phenaproxima I like the idea personally as it seems to be addressing the root cause. Wonder if you'll be able to reuse the test case though.