zendframework/zf2 — pull request #2791 by ctoomey (2012-10-17 22:52:09+00:00)
Title: Fixed Zend\Di\Di::get() to use 'shared' config. setting as advertised

Fixed Zend\Di\Di::get() to use 'shared' config. setting as advertised, per email to fw-general@ today:

I've been using the ZF2 Di component for quite a while and have just recently come across a need to *not* share instances of a certain class managed by the container. Though Di\Config.php properly parses out the 'shared' instance config. parameter and calls setShared() on the instance manager, in Di.php the get() method doesn't actually look for that config. setting and pass it along when it calls newInstance(), even though its comment documentation says it will honor that -- "Attempts to load the class (or service alias) provided. If it has been loaded before, the previous instance will be returned (unless the service definition indicates shared instances should not be used)."

The patch includes the fix and a new unit test to verify it works.