ZF2-283: Incorrectly merging of DI.definition.class.instantiator


When two or more modules define the following definition the method (factory) becomes incorrectly uncallable...

return array(
    'di' => array(
        'definition' => array(
            'class' => array(
                'Zend\Cache\Storage\Adapter\Filesystem' => array(
                    'instantiator' => array(
Fatal error: Uncaught exception 'RuntimeException' with message 'Invalid instantiator: Zend\Cache\StorageFactory::factory() is not callable.' in /vendor/ZendFramework/library/Zend/Di/Di.php:198

On investigation is seems the 'instantiator' array is merged incorrectly, as it contents will be the following, which is indeed not a valid PHP callback.

    [0] => Zend\Cache\StorageFactory
    [1] => factory
    [2] => Zend\Cache\StorageFactory
    [3] => factory

I am unsure how to resolve such a configuration. Should DI assume the first two keys as correct?


This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: