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\Core\Render\Element\StatusReport::preRenderGroupRequirements()
and \Drupal\user\PermissionHandler::sortPermissions()
sorts return bools. As these a PHP user sort functions it expects -1, 0 or 1. In PHP 8 returning a bool triggers a warning.
Proposed resolution
Use the spaceship operator to return the correct type.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
N/a
Comment | File | Size | Author |
---|---|---|---|
#2 | 3156882-2.patch | 1.55 KB | alexpott |
Comments
Comment #2
alexpottComment #3
johnwebdev CreditAttribution: johnwebdev commentedLooks good!
PermissionHandler::sortPermissions is covered by PermissionHandlerTest::testBuildPermissionsSortPerModule().
Not sure if StatusReport render element has any test coverage.
Searched for more occurrences, but did not find any.
Comment #6
alexpottCreditting pfrenssen, adityasingh for this due to the fix being suggested by pfrenssen and the initial patch supplied by adityasingh over on #3156595-9: Make Drupal 9 installable on PHP8
Comment #10
catchCommitted/pushed to 9.1.x and cherry-picked back to 8.9.x, thanks!