Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
render system
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Sep 2021 at 08:09 UTC
Updated:
1 Oct 2021 at 23:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
alexpottComment #3
longwaveDo we need a test for this?
Comment #4
alexpott@longwave there's no change of output. A NULL value currently be changed to an empty string because it would be cast implicitly by the built-in php functions that in PHP 8.1 are now emitting a deprecation. Test coverage comes when we have PHP 8.1 testing.
Comment #5
alexpottSee \Drupal\Tests\Core\Render\Element\HtmlTagTest::providerPreRenderHtmlTag() we already have a test case for NULL values.
Comment #6
longwaveAh OK, the existing test triggers the deprecation in PHP 8.1, that makes sense.
Comment #7
larowlanI think this would read better as a new method, then you could return early and avoid elseif/else.
Also means it can scale in the future if there are other cases
Comment #8
alexpott@larowlan I'm not sure about #7. There's a wasted call to Markup::create() and Xss::filterAdmin() on a NULL and this is not really an extension point or API so I can't see where the other cases come.
Comment #9
larowlanThere's a time and place to push my elseif is a code-smell agenda, but a critical that blocks php8.1 is not it.
Will commit this shortly, restoring RTBC
Comment #11
larowlanCommitted 6769562 and pushed to 9.3.x. Thanks!