laminas / laminas-i18n

Provide translations for your application, and filter and validate internationalized values
https://docs.laminas.dev/laminas-i18n/
BSD 3-Clause "New" or "Revised" License
46 stars 27 forks source link

Translator factory has hidden dependency on laminas/laminas-cache-storage-deprecated-factory #134

Open rieschl opened 1 month ago

rieschl commented 1 month ago

Bug Report

Q A
Version(s) 2.28.0

Summary

We cleaned up our composer dependencies and removed the laminas/laminas-cache-storage-deprecated-factory because there weren't any usages in our code. After that, the factory of the Translator exploded because it tries to instantiate the cache for the translator with the StorageFactory from said package.

Current behavior

The application explodes because \Laminas\Cache\StorageFactory cannot be found.

How to reproduce

Add

    'translator' => [
        'cache' => [
            'adapter' => [
                'name' => \Laminas\Cache\Storage\Adapter\Memory::class,
            ],
        ],
    ],

to the config and try to pull \Laminas\I18n\Translator\Translator from the container or build it with Translator::factory($options) where $options is the above array inside the translator key.

Expected behavior

No boom πŸ™‚ I think either the dependency should be added to the require section and not require-dev or the factory should use the new StorageAdapterFactoryInterface(?) instead of the deprecated one.

froschdesign commented 1 month ago

I think either the dependency should be added to the require section and not require-dev or the factory should use the new StorageAdapterFactoryInterface(?) instead of the deprecated one.

The problem is the soft dependency on laminas-cache. If laminas-cache is not needed then the deprecated factory is also not needed. This will be solved with the next major version because the soft dependencies are crap. And caching in general should not be integrated in the translator or in a paginator.