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
Posted by Dan Rossi (danielr) on 2012-01-02T07:34:52.000+0000
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
Posted by Dan Rossi (danielr) on 2012-01-02T07:41:25.000+0000
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
Posted by Ralph Schindler (ralph) on 2012-10-08T20:15:36.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/2446