Issues

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

Issue Type: Bug Created: 2011-12-12T08:37:43.000+0000 Last Updated: 2012-10-08T20:15:36.000+0000 Status: Closed Fix version(s): Reporter: Patrik Kölbl (insekticid) Assignee: Ralph Schindler (ralph) Tags: - Zend\Di

Related issues: Attachments:

Description

module.config.php example

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() []: 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/…](https://github.com/zendframework/zf2/blob/master/library/Zend/Di/Di.php#L495) elseif (is\_string($iConfigCurValue) && $this->definitions->hasClass($iConfigCurValue)) hasClass() will call class\_exists() [https://github.com/zendframework/zf2/…](https://github.com/zendframework/zf2/blob/master/library/Zend/Di/Definition/RuntimeDefinition.php#L91) and result is warning from StandardAutoloader my quickfix is closure 'Doctrine\MongoDB\Connection' => array( 'parameters' => array( 'server' => (function () {return 'mongodb://127.0.0.1:27017/db';}), '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:

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