laminas / laminas-crypt

Strong cryptography tools and password hashing
https://docs.laminas.dev/laminas-crypt/
BSD 3-Clause "New" or "Revised" License
39 stars 24 forks source link

has() and get() function not compatible with psr/container 1.1.1 using declare_strict or preload #23

Closed lampi87 closed 2 years ago

lampi87 commented 2 years ago

BC Break Report

Q A
Version 3.8.0

Summary

Current implementation of has() and get() functions not compatible with psr/container 1.1.1 using opcache.preload or declare_strict

PHP Fatal error: Declaration of Laminas\Crypt\Symmetric\PaddingPluginManager::has(string $id) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/.../vendor/laminas/laminas-crypt/src/Symmetric/PaddingPluginManager.php on line 32 PHP Fatal error: Declaration of Laminas\Crypt\Symmetric\PaddingPluginManager::get($id) must be compatible with Psr\Container\ContainerInterface::get(string $id): object in /var/www/.../vendor/laminas/laminas-crypt/src/Symmetric/PaddingPluginManager.php on line 43

Same for has and get in Laminas\Crypt\SymmetricPluginManager

github-actions[bot] commented 2 years ago

This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steering Committee. If you have a security issue, please follow our security reporting guidelines. If you wish to take on the role of maintainer, please nominate yourself

Ocramius commented 2 years ago

Hmm, what version of laminas/laminas-servicemanager is installed?

lampi87 commented 2 years ago

Version 3.11.2 of laminas/laminas-servicemanager is installed.

If I compare psr/container 1.1.2 and given files/functions:

public function has($id) vs public function has(string $id)

Ocramius commented 2 years ago

Wait, so your local PSR container has a different signature than the one in the upstream reposi? O.o

See https://github.com/php-fig/container/blob/1.1.2/src/ContainerInterface.php#L22

lampi87 commented 2 years ago

Both lines where copied from checkout out files in my local vendor dir.

I'm not sure why : object or : bool is mentioned as required in logs

Ocramius commented 2 years ago

I suspect that your ContainerInterface is declared by a third party: try using reflection to find where it is loaded from.

Meanwhile, closing here, since the issue is not in this package.

lampi87 commented 2 years ago

You're right. The issue is related to package laminas/laminas-inputfilter. The File .psr-container-stub.php has a more strict declaration for Psr\Container\ContainerInterface. I'll create an issue there

Ocramius commented 2 years ago

@lampi87 that file is NOT autoloaded