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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
FileSize
1.55 KB
johnwebdev’s picture

Status: Needs review » Reviewed & tested by the community

Looks 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.

alexpott’s picture

Creditting 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

  • catch committed edea783 on 9.1.x
    Issue #3156882 by alexpott, johnwebdev, adityasingh, pfrenssen: \Drupal\...

  • catch committed ea5c76d on 8.9.x
    Issue #3156882 by alexpott, johnwebdev, adityasingh, pfrenssen: \Drupal\...

  • catch committed 8dd0e32 on 9.0.x
    Issue #3156882 by alexpott, johnwebdev, adityasingh, pfrenssen: \Drupal\...
catch’s picture

Version: 9.1.x-dev » 8.9.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 9.1.x and cherry-picked back to 8.9.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.