Skip to content

Migrate to Slim 4.x #2170

@europrimus

Description

@europrimus

Hello,
I my shaarli error.log, I have lot of this error:

2025/12/07 20:08:01 [error] 1457181#1457181: *1708608 FastCGI sent in stderr: "
PHP message: Return type of Slim\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; 
PHP message: Return type of Slim\Collection::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; 
PHP message: Return type of Slim\Collection::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; 
PHP message: Return type of Slim\Collection::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice;
PHP message: Return type of Slim\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; 
PHP message: Return type of Slim\Collection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; 
PHP message: Return type of Slim\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; 
PHP message: Return type of Slim\Collection::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; 
PHP message: Return type of Slim\Collection::offsetSet($key, $value) should either be compatible wit

It is the same as this two issues PHP deprecations/errors with PHP 8.2 #2020 and PHP 8.2 compatibility #1935

the website work fine.
I am using yunohost package v 0.15.0~ynh1, php version 8.2

What I understand is this error come from the slim famework.
Shaarli use version 3.0 and I found an issue on slim about slim 3.x and PH 8.x PHP 8.1 deprecated warnings for Slim 3.x

Look like there is some work to do to migrate from Slim V3 to V4
And slim 4.x requires PHP 7.4 or newer, maybe some shaarli run on older php version.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions