Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
\Drupal\KernelTests\Core\Render\Element\ActionsTest::getFormId()
returns NULL
and cause deprecation on PHP 8.1.
Because \Drupal\Core\Form\FormBuilder::prepareForm()
calls \Drupal\Component\Utility\Html::getId()
with NULL as form ID so mb_strtolower()
throws deprecation
$form['#attributes']['data-drupal-selector'] = Html::getId($form_id);
Steps to reproduce
Run core/tests/Drupal/KernelTests/Core/Render/Element/ActionsTest.php
on PHP 8.1
2x: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
2x in ActionsTest::testDropbuttonWithBubbleableMetadata from Drupal\KernelTests\Core\Render\Element
1x: strrpos(): Passing null to parameter #1 ($haystack) of type string is deprecated
1x in ActionsTest::testDropbuttonWithBubbleableMetadata from Drupal\KernelTests\Core\Render\Element
Proposed resolution
return string from \Drupal\KernelTests\Core\Render\Element\ActionsTest::getFormId()
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#2 | 3240960-2.patch | 510 bytes | andypost |
Comments
Comment #2
andypostFix from https://git.drupalcode.org/project/drupal/-/commit/5d05ac41313dfc37f2ae9...
even empty string is enough here
Comment #3
andypostfix parent after clone
Comment #4
daffie CreditAttribution: daffie commentedLooks good to me.
Comment #5
larowlanCommitted 0247f92 and pushed to 9.3.x. Thanks!