zendframework/zf2 — pull request #3439 by netiul (2013-01-15 16:12:43+00:00)
Title: Tests that the test if the individual shared setting overrides the shareByDefault setting

Fixing is not as easy as it looks.

Making the tests succeed can be achieved by changing the following 3 lines https://github.com/zendframework/zf2/blob/master/library/Zend/ServiceManager/ServiceManager.php#L461

```php
if ($this->shareByDefault() && (!isset($this->shared[$cName]) || $this->shared[$cName] === true)) {
$this->instances[$cName] = $instance;
}
```

into

```php
if (
($this->shareByDefault() && !isset($this->shared[$cName]))
|| (isset($this->shared[$cName]) && $this->shared[$cName] === true)
) {
$this->instances[$cName] = $instance;
}
```

But another problem lies in how the shared setting of the indivual services are set: as the third parameter of `setInvokableClass($name, $invokableClass, $shared = true)` and `setFactory($name, $factory, $shared = true)` which sets the ***individual*** shared setting always to yes by default.

Any ideas are welcome.