Issues

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

Issue Type: Bug Created: 2012-05-01T13:59:00.000+0000 Last Updated: 2012-10-08T20:15:19.000+0000 Status: Closed Fix version(s): Reporter: Bas K (bas) Assignee: Ralph Schindler (ralph) Tags: - Zend\Di

  • di-merging-callback

Related issues: Attachments:

Description

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

<pre class="highlight">
return array(
    'di' => array(
        'definition' => array(
            'class' => array(
                'Zend\Cache\Storage\Adapter\Filesystem' => array(
                    'instantiator' => array(
                        'Zend\Cache\StorageFactory',
                        'factory',
                    ),
                ),
            ),
        ),
    ),
);



<pre class="literal"> 
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.

<pre class="highlight">
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

Posted by Ralph Schindler (ralph) on 2012-10-08T20:15:19.000+0000

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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts