? ? Pending

User tests: Successful: Unsuccessful:

avatar HLeithner
HLeithner
31 Dec 2021

usort throws an error when callback functions requires a reference.

JArrayHelper::_sortObjects(): Argument #1 ($a) must be passed by reference, value given

Summary of Changes

Removed & from _sortObjects parameter signature

Testing Instructions

Use JArrayHelper::sortObjects

Actual result BEFORE applying this Pull Request

  • error message on php 8+

Expected result AFTER applying this Pull Request

No error message

avatar HLeithner HLeithner - open - 31 Dec 2021
avatar HLeithner HLeithner - change - 31 Dec 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 Dec 2021
Category Libraries
avatar richard67
richard67 - comment - 31 Dec 2021

@HLeithner Does it really need a real test here? I think it should be sufficient by review with respect to https://www.php.net/manual/en/function.usort.php showing by value parameters for the callback:

 callback
    The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
    callback(mixed $a, mixed $b): int
avatar HLeithner
HLeithner - comment - 31 Dec 2021

Don't think so because unit tests are successful on all (old) php versions and I know the tests are working ;-)

avatar Fedik Fedik - change - 2 Jan 2022
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-01-02 07:53:00
Closed_By Fedik
Labels Added: ? ?
avatar Fedik Fedik - close - 2 Jan 2022
avatar Fedik Fedik - merge - 2 Jan 2022
avatar Fedik
Fedik - comment - 2 Jan 2022

danke!

Add a Comment

Login with GitHub to post a comment