zendframework / zend-servicemanager

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

Fix problem with string callables failing in PHP 5.6. #206

Closed demiankatz closed 6 years ago

demiankatz commented 6 years ago

ServiceManager v2 supported configuring factories to callable strings of the form 'Class::Method', as a concise alternative to ['Class', 'Method'].

ServiceManager v3 continues to support this for PHP 7, but for some reason, the feature breaks in PHP 5.6.

This pull request includes a possible fix as well as a test that demonstrates the problem; without my proposed code changes to the ServiceManager, the test dies with a fatal error in PHP 5.6, but passes in PHP 7.

If there is a more elegant solution, I would welcome feedback. If this support is being dropped intentionally, we should at least find a way to fail more gracefully.

demiankatz commented 6 years ago

@Xerkus, I received a notification that you had left a comment here, but I no longer see it. Does that mean you were able to reproduce the problem successfully?

Xerkus commented 6 years ago

Yes, I made wrong test case at first https://3v4l.org/h8MEs

demiankatz commented 6 years ago

Thanks!

weierophinney commented 6 years ago

Thanks, @demiankatz