zendframework / zend-validator

Validator component from Zend Framework
BSD 3-Clause "New" or "Revised" License
181 stars 136 forks source link

Exception when using attachByName on a validator chain #145

Closed mkherlakian closed 7 years ago

mkherlakian commented 7 years ago

Tested on ZF 2.5.1 Running the code example in https://framework.zend.com/manual/2.4/en/modules/zend.input-filter.intro.html#introduction yields an exception:

Argument 1 passed to Zend\ServiceManager\AbstractPluginManager::__construct() must be an instance of Zend\ServiceManager\ConfigInterface, instance of Zend\ServiceManager\ServiceManager given, called in /opt/potwallet_web/vendor/zendframework/zend-validator/src/ValidatorPluginManager.php on line 382 and defined in /opt/potwallet_web/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php on line 62

The problematic line is in https://github.com/zendframework/zend-validator/blob/master/src/ValidatorChain.php#L70

when the plugin manager is not initialized. $this->setPluginManager(new ValidatorPluginManager(new ServiceManager));

the PluginManager constructor's argument is expected to implement ConfigInterface, ServiceManager doesn't.

weierophinney commented 7 years ago

(Discussed offline with @mkherlakian , and agreed as a "won't fix" due to being a non-LTS version, and the latest version resolving the issue.)

If you could... could you please submit an issue against the website repository so that we can ensure a big banner is posted across those legacy pages indicating folks should look to https://docs.zendframework.com for up-to-date documentation?

mkherlakian commented 7 years ago

Will do @weierophinney. Also closing this one out per your comment. Thanks!