Problem/Motivation
\Drupal\media\Plugin\Filter\MediaEmbed::applyPerEmbedMediaOverrides() could use to pass NULL to DOMElement::setAttribute()
$doc = new DOMDocument("1.0");
$node = $doc->createElement("para");
$newnode = $doc->appendChild($node);
$newnode->setAttribute("align", NULL);
var_dump($newnode->getAttribute("align"));
Fix from https://git.drupalcode.org/project/drupal/-/commit/a27bd8682c4eb5d87a55e...
Steps to reproduce
Run core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php on PHP 8.1
From testOverridesAltAndTitle()
2x: DOMElement::setAttribute(): Passing null to parameter #2 ($value) of type string is deprecated
2x in MediaEmbedFilterTest::testOverridesAltAndTitle from Drupal\Tests\media\Kernel
Proposed resolution
Pass empty string instead
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3240955-2.patch | 791 bytes | andypost |
Comments
Comment #2
andyposthttps://3v4l.org/IWGqr
patch from https://git.drupalcode.org/project/drupal/-/commit/a27bd8682c4eb5d87a55e...
Comment #3
daffie commentedLooks good to me.
Comment #5
catchCommitted 4efea3f and pushed to 9.3.x. Thanks!