Deprecated function: usort()

Created on 12 March 2023, almost 2 years ago
Updated 11 May 2023, over 1 year ago

Problem/Motivation

Error message on (some) menu admin pages (e.g. admin/structure/menu/manage/main):

Deprecated function: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in Drupal\targets\TargetManager->getTargetFromPath() (line 181 of modules/contrib/targets/src/TargetManager.php).

Steps to reproduce

Drupal 9.5.4
PHP 8.1.13
Target 1.1.4

Proposed resolution

In targets/src/TargetManager.php:

Modify
return $a_index > $a_index;
to
return (int) $b_index - (int) $a_index;

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium tvb

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

Comments & Activities

Production build 0.71.5 2024