Issues

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

Description

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(
                        'Zend\Cache\StorageFactory',
                        'factory',
                    ),
                ),
            ),
        ),
    ),
);
 
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.


Array
(
    [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?

Comments

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2474