-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite loop when fetching some cache-related services via container in projects without registered config
service
#286
Conversation
Signed-off-by: Jens Hatlak <jens.hatlak@check24.de>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
…te on projects without project configuration Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
This fixes an infinite loop in combination with `laminas-servicemanager` as outlined in laminas#284 Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
config
service
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…` method is not calling container Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted a typo in the docs, and also the constant name PRESERVED_
should be RESERVED_
right?
docs/book/v3/application-integration/usage-in-a-laminas-mvc-application.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
docs/book/v3/application-integration/usage-in-a-laminas-mvc-application.md
Outdated
Show resolved
Hide resolved
docs/book/v3/application-integration/usage-in-a-laminas-mvc-application.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
@@ -14,7 +14,8 @@ | |||
*/ | |||
class StorageCacheAbstractServiceFactory implements AbstractFactoryInterface | |||
{ | |||
public const CACHES_CONFIGURATION_KEY = 'caches'; | |||
public const CACHES_CONFIGURATION_KEY = 'caches'; | |||
private const RESERVED_CONFIG_SERVICE_NAME = 'config'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why introduce constant? Lines 76 and 81 are not using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because its way more readable than just having a random string somewhere.
The get
does not need to check for the requested name as it shouldn't get passed due to the canCreate
method returning false (implicit check).
I did a quick lookup with phpdbg
and from what I can see, having this constant does not even produce more opcodes than using string here.
So IMHO, due to readability and same opcode amount, it should be fine having this around.
The factory `Laminas\Cache\Service\StorageCacheAbstractServiceFactory` uses the configuration, searches for the configuration key `caches` and creates the storage adapters using the discovered configuration. | ||
The factory `Laminas\Cache\Service\StorageCacheAbstractServiceFactory` uses the configuration, searches for the configuration key `caches` and creates the storage adapters using the discovered configuration. | ||
|
||
WARNING: **Cache Named `config` Is Not Possible** | ||
A cache named `config` is not possible due to internal service conflicts with MVC configuration. | ||
The service named `config` is reserved for project configuration and thus cannot be used with the `caches` configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache name must be unique identifier in container. Not just config but any conflicting name is not possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yah but thats usually up to the user while it is not for config
as we now do have explicit check within the abstract static factory.
So I think this might be good enough for now. We still should tackle this specific issue within laminas-servicemanager
.
Description
Add regression test for issue #284