You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I made a mistake in my configuration which lead me to infinite recursion (segfaulting). Turns out I had the name of the lazy storage in my environment variable, trying to infinitely create itself through LazyFactory::create()
parameters:
env(RECURSION_SOURCE): recursion
flysystem:
storages:
recursion:
adapter: 'lazy'
options:
source: '%env(RECURSION_SOURCE)%' #also breaks if I just fill in "recursion" here
Due to the nature of being a runtime calculation on which storage to use, I think the factory should probably validate that it's not trying to initialize the lazy adapter as the lazy adapter. If multiple levels of factories should be support (lazy -> lazy -> real) my suggestion won't solve it, but this would be a fix for my scenario:
class LazyFactory
{
private$storages;
publicfunction__construct(ContainerInterface$storages)
{
$this->storages = $storages;
}
publicfunctioncreateStorage(string$source, string$storageName)
{
if ($source === $storageName) {
thrownew \InvalidArgumentException('... some message saying you try to initialize the lazy adapter');
}
if (!$this->storages->has($source)) {
thrownew \InvalidArgumentException('You have requested a non-existent source storage "'.$source.'" in lazy storage "'.$storageName.'".');
}
return$this->storages->get($source);
}
}
The text was updated successfully, but these errors were encountered:
I made a mistake in my configuration which lead me to infinite recursion (segfaulting). Turns out I had the name of the lazy storage in my environment variable, trying to infinitely create itself through
LazyFactory::create()
Due to the nature of being a runtime calculation on which storage to use, I think the factory should probably validate that it's not trying to initialize the lazy adapter as the lazy adapter. If multiple levels of factories should be support (lazy -> lazy -> real) my suggestion won't solve it, but this would be a fix for my scenario:
The text was updated successfully, but these errors were encountered: