silverstripe/silverstripe-framework — pull request #2946 by tractorcow (2014-03-12 02:10:25+00:00)
Title: BUG Fix issue with inheritance of Injector service configuration

This issue came up in a case where a parent class had a particular set of dependencies specified, and while direct subclasses of this would work fine with Injector, attempts to instantiate sub-subclasses of this would result in missing dependencies.

E.g. A extends B extends C, where only C has dependencies specified, and attempts to create an instance of A would break future calls to `B::create()`.

The `SilverStripeServiceConfigurationLocator` would walk from A to C finding dependencies, and during this process "B" would be marked with a config of `false`, meaning future calls to `B::create()` (or sometimes `A::create()`) would incorrectly ignore all dependencies.

This fix no longer marks a class as having a `false` config unless its parent has a `false` config, or if there are no other parents above this.

`SilverStripeServiceConfigurationLocator` was also refactored to be a bit more test-case friendly and better documentation given.

This was a fun afternoon trying to debug...