zendframework / zend-servicemanager

ServiceManager component from Zend Framework
BSD 3-Clause "New" or "Revised" License
188 stars 89 forks source link

Undefined `$factory` notice fix #269

Closed demiankatz closed 6 years ago

demiankatz commented 6 years ago

When a plugin manager uses a static class method as a factory (i.e. FactoryClass::factoryMethod), as of release 2.7.10, it causes an undefined variable notice to be thrown due to an uncovered else case. This pull request provides a test case to demonstrate the problem as well as a fix. This problem does not appear to exist in the 3.x code, so it is presumably a side effect of backporting to 2.7. However, for projects depending on earlier versions of the service manager, it can be a significant problem and should be corrected -- that is why I am targeting this PR against the release-2.7 branch.

Ocramius commented 6 years ago

Thanks @demiankatz! Released in 2.7.11 :-)