prooph / pdo-snapshot-store

PDO Snapshot Store

Home Page:http://getprooph.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PdoSnapshotStoreFactory is trying to modificate 'config' object

greatkir opened this issue · comments

Hello,
I'm trying to integrate this great package with my existing project.
I've encountered a problem with the PdoSnapshotStoreFactory on line 66: $config = &$config[$dimension]; the factory tries to change an existing object provided by the Container.
Is it an expected behavior? In my environment, it throws an Indirect modification of overloaded element of Illuminate\\Config\\Repository has no effect because of this modification attempt. In some other environments, there can be other difficulties because of modification of the external object.

Is it possible to solve this issue and don't change the config object provided by the Container?

@sandrokeil can you elaborate?

It was introduced with PR #21 maybe we have to check if it's an object? /cc @basz

Maybe you can create a separate variable in the anonymous function for the config connection value needed because the problem is in changing the $config internal value?

I'm not sure this is fixable. As the Illuminate Repository class does not allow for this 'Indirect modification of overloaded element'.

$config = new Repository([]);
$config['test']['test'] = 1;
// Indirect modification of overloaded element of Illuminate\Config\Repository has no effect

Extracting the config array from an ArrayObject in a generic way is also not possible. Illuminate\Config\Repository uses ->all(), Zend/Config/Config uses -> toArray(), and who knows what others do.

Maybe it is time to simply remove this fix. Perhaps throw an exception if the key is still omitted? Would be BC though.

Since this issue seems to be stalled, I'll close it. Feel free to reopen or create a new issue.