Kyslik / column-sortable

Package for handling column sorting in Laravel 5/6/7/8
MIT License
644 stars 105 forks source link

Use of each() #75

Closed JurjenRoels closed 6 years ago

JurjenRoels commented 6 years ago

Hello,

I get the following error.

ErrorException (E_DEPRECATED) The each() function is deprecated. This message will be suppressed on further calls

on vendor/kyslik/column-sortable/src/ColumnSortable/Sortable.php

starting line 180 reset($sort); $each = each($sort);

    return ($each[0] === 0) ? ['sort' => $each[1], 'order' => $configDefaultOrder] : [
        'sort'  => $each[0],
        'order' => $each[1],
    ];
}

Maybe there are more uses of each()

Regards

Kyslik commented 6 years ago

YES, I was meaning to remove it will work on it today, are you on L5.5?

Its because each function is depreciated and if you are on PHP7.2 it will not work.

JurjenRoels commented 6 years ago

Kyslik,

I am on 5.5 and changed the code on line 79 and onwards with:

foreach($sort as $each); { return ($each[0] === 0) ? [‘sort’ => $each[1], ‘order’ => $configDefaultOrder] : [ ‘sort’ => $each[0], ‘order’ => $each[1], ]; }

Not completely sure if that is what you want it to be. But it works again.

Kyslik commented 6 years ago

No worries I know where the issue is :) will push new version today. Thanks a lot!

Kyslik commented 6 years ago

@JurjenRoels please try with

dev-L5.5-fix-75

composer.json

"require": {
    "kyslik/column-sortable": "dev-L5.5-fix-75",
    ...
},
Kyslik commented 6 years ago

Fixed and tagged at 5.5.4, 5.4.10, 5.3.9, 5.2.9, 5.1.13.

JurjenRoels commented 6 years ago

Thank you!

It works again :)

Op 29 nov. 2017, om 13:07 heeft Martin Kiesel notifications@github.com het volgende geschreven:

@JurjenRoels https://github.com/jurjenroels please try with

dev-L5.5-fix-75

composer.json

"require": { "kyslik/column-sortable": "dev-L5.5-fix-75", ... }, — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Kyslik/column-sortable/issues/75#issuecomment-347841278, or mute the thread https://github.com/notifications/unsubscribe-auth/Aggtn9jI5ktfm_iTiy6Udb1FvuXuy8wCks5s7UkKgaJpZM4Qunkh.