You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
InputFilterPluginManager creates defined InputFilter
Actual results
Exception thrown
Plugin of type MyInput is invalid; must implement Zend\InputFilter\InputFilterInterface or Zend\InputFilter\InputInterface
Imho this happens because Module.php provide incomplete config.
public function getConfig()
{
$provider = new ConfigProvider();
return [
'service_manager' => $provider->getDependencyConfig(),
'input_filters' => $provider->getInputFilterConfig(), // this line is missing
];
}
The text was updated successfully, but these errors were encountered:
@Xerkus
I think @vaclavvanik wants to insert the input-filter specification as an array into the configuration and for this the InputFilterAbstractFactory must be added manually as described in the documentation:
Setup
When using zend-mvc version 2 releases, this functionality is disabled by default. To enable it, you must add the Zend\InputFilter\InputFilterAbstractServiceFactory abstract factory to the Zend\InputFilter\InputFilterPluginManager configuration, which is under the input_filters configuration key.
@froschdesign as I wrote above I think, that it is a bug, that in Module.php is missing config line with input_filters. Which causes that InputFilterAbstractFactory is not registered in InputFilterPluginManager.
In ConfigProvider is InputFilterAbstractFactory registered.
For Expressive when using the configuration manager, and for zend-mvc v3 releases, the functionality is enabled by default, assuming you are using the component installer.
I am using mvc v3 and InputFilterAbstractFactory is not registered... :-/
Just checked, docs are indeed wrong. It is not registered for any mvc version by default.
Are there any reasons why we wouldn't want to enable it by default for mvc as well?
@vaclavvanik
I'm confused, unfortunately. If you use version v3 then you should have also the last version of zend-inputfilter! And the latest of version of zend-inputfilter contains the InputFilterAbstractFactory!
@froschdesign#162 fixed InputFilterAbstractFactory registration in ConfigProvider (Expressive). MVC v3 uses Module and in this class has not 'input_filters' config key in getConfig() which causes that InputFilterAbstractFactory is not registered... (really confusing)
InputFilterPluginManager in MVC environment does not create input filter defined in config.
Code to reproduce the issue
Expected results
InputFilterPluginManager creates defined InputFilter
Actual results
Exception thrown
Imho this happens because Module.php provide incomplete config.
The text was updated successfully, but these errors were encountered:
@weierophinney do you think it is a bug? Should I create PR?
@vaclavvanik
Please look at:
zend-inputfilter/src/Module.php
Lines 30 to 42 in a23e67d
...and you will find
input_filters
.Or do you try to add the entire specification as array in the configuration and not the factories?
Doesn't it say the problem right here:
zend-inputfilter/src/InputFilterPluginManager.php
Lines 125 to 143 in a23e67d
your
MyInput
class does not implement those interfaces or extend other class that does@Xerkus
I think @vaclavvanik wants to insert the input-filter specification as an array into the configuration and for this the
InputFilterAbstractFactory
must be added manually as described in the documentation:https://docs.zendframework.com/zend-inputfilter/specs/#setup
@froschdesign I see,
$autoAddInvokableClass = true
masked the problem.@froschdesign as I wrote above I think, that it is a bug, that in
Module.php
is missing config line withinput_filters
. Which causes thatInputFilterAbstractFactory
is not registered inInputFilterPluginManager
.In ConfigProvider is
InputFilterAbstractFactory
registered.@vaclavvanik
Did you see the hint in the documentation?
In the docs is:
For Expressive when using the configuration manager, and for zend-mvc v3 releases, the functionality is enabled by default, assuming you are using the component installer.
I am using mvc v3 and
InputFilterAbstractFactory
is not registered... :-/Just checked, docs are indeed wrong. It is not registered for any mvc version by default.
Are there any reasons why we wouldn't want to enable it by default for mvc as well?
@vaclavvanik
I'm confused, unfortunately. If you use version v3 then you should have also the last version of zend-inputfilter! And the latest of version of zend-inputfilter contains the
InputFilterAbstractFactory
!Or I'm wrong?
See:
@vaclavvanik
I will create a pull request when I'm back on my computer and will ping you for testing.
@froschdesign #162 fixed
InputFilterAbstractFactory
registration inConfigProvider
(Expressive). MVC v3 usesModule
and in this class has not 'input_filters' config key ingetConfig()
which causes thatInputFilterAbstractFactory
is not registered... (really confusing)@vaclavvanik
Right, because in zend-form is the behaviour different. 😕
72b1cba
Merge branch 'hotfix/181'
e4101c9