Deprecated function: usort() in PHP 8.1

Created on 26 October 2024, about 2 months ago

Problem/Motivation

Deprecated function: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in EntityTranslationDefaultHandler->localTasksAlter() (line 1681 of /data/sites/web/www/sites/all/modules/entity_translation/includes/translation.handler.inc)

Steps to reproduce

Error on edit of translated node. After update from PHP 7.4 to 8.1

Proposed resolution

Changed on line 1698 of file entity_translation/includes/translation.handler.inc

  protected function translationTabSort($a, $b) {
    return $a['#link']['weight'] > $b['#link']['weight'];
  }

into this:

  protected function translationTabSort($a, $b) {
    return $a['#link']['weight'] <=> $b['#link']['weight'];
  }
🐛 Bug report
Status

Active

Version

3.0

Component

Base system

Created by

🇧🇪Belgium yazzbe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024