ZF2-120: Zend Dependency Injection param containing "://" is recognized as stream wrapper

Description

module.config.php example

<?php $default = array( 'di' => array( 'instance' => array( 'Doctrine\MongoDB\Connection' => array( 'parameters' => array( 'server' => 'mongodb://127.0.0.1:27017/db', 'options' => array(), ) ) ), ),

Result is Warning: stream_resolve_include_path() [function.stream-resolve-include-path]: Unable to find the wrapper "mongodb" - did you forget to enable it when you configured PHP? in library\Zend\Loader\StandardAutoloader.php on line 304

Problem is here https://github.com/zendframework/zf2/…

elseif (is_string($iConfigCurValue) && $this->definitions->hasClass($iConfigCurValue))

hasClass() will call class_exists() https://github.com/zendframework/zf2/…

and result is warning from StandardAutoloader

my quickfix is closure

        'Doctrine\MongoDB\Connection' => array(
            'parameters' => array(
                'server' => (function () {return '<a rel="nofollow" href="mongodb://127.0.0.1:27017/db">mongodb://127.0.0.1:27017/db</a>';}),
                'options' => array(),
            )
        )

Comments

Confirmed this is a problem. For a moment i thought mongodb wasn't working I get the same

Warning: stream_resolve_include_path() [function.stream-resolve-include-path]: Unable to find the wrapper "mongodb" - did you forget to enable it when you configured PHP? in /path/vendor/ZendFramework/library/Zend/Loader/StandardAutoloader.php on line 304 mongodb://localhost:27017

That quick fix worked

'connection' => array( //'server' => "mongodb://localhost:27017", 'server' => (function () {return 'mongodb://127.0.0.1:27017/scavengers';}), ),

Im using the spiffy implementation, would be good to see it all implemented as default. I get an "invalid argument" error now though

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/2446