zendframework / zend-inputfilter

InputFilter component from Zend Framework
BSD 3-Clause "New" or "Revised" License
64 stars 50 forks source link

Class Zend\ServiceManager\AbstractPluginManager not found #119

Closed mkroeders closed 6 years ago

mkroeders commented 8 years ago

When you run zendframework/zend-inputfilter as a stand alone library you get Class Zend\ServiceManager\AbstractPluginManager not found with the following code

$filter = new \Zend\InputFilter\InputFilter();
$input = new \Zend\InputFilter\Input('test');
$filter->add($input);

$filter->setData([]);

$filter->isValid();
$filter->getMessages();

This is due to the fact of \Zend\InputFilter\Input line 500, where the plugin chain is used. Which in turn uses the ValidatorPluginManager, which extends the Zend\ServiceManager\AbstractPluginManager. This class is not loaded because it is not part of the dependency.

To fix this issue zendframework/zend-servicemanager needs to be a dependency, and not dev only.

froschdesign commented 6 years ago

It's already there. Please look at the suggest section in the Composer file: https://github.com/zendframework/zend-inputfilter/blob/9569f7e18122d57b66c95ff2f02472937f26db46/composer.json#L26-L28

Btw. sorry for the late response.

Zebercet commented 6 years ago

I think this issue is not invalid. Because it's not a sugggest. You have to install servicemanager to use inputfilter

Xerkus commented 6 years ago

Direct dependency was introduced in #67

settermjd commented 6 years ago

@Xerkus, imo @Zebercet is correct. While it is introduced as a direct dependency in #67, zend-inputfilter/composer.json only suggests it. To me that's incorrect functionality. zend-servicemanager should be moved to be a core requirement.

voku commented 6 years ago

I used the package yesterday for the first time and got this strange error ... so after a quick google-search I found this thread and now I know that I need to add "zend-servicemanager", but it isn't intuitive :/