Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Ensure filter and validator chains receive default plugin managers #156

Conversation

weierophinney
Copy link
Member

Per #155, When using the factory, particularly with the InputFilterAbstractServiceFactory, the plugin managers used with the default filter and validator chains should be used with all newly created inputs, as these will have any custom services registered (vs. those that are in the initially created inputs, which are unconfigured).

This means that:

  • For cases where the instance was pulled from the InputFilterManager, we need to inject the filter and validator chains with the plugin managers pulled from the default instances; if the chain does not exist, we clone the default instance.
  • For other instances, we need to simply clone the default filter and validator chains (which are empty, but have the configured filter and validator plugin managers).

This patch also contains two unrelated fixes, but they are included so that the test suite will actually pass under PHP 7.2:

  • An update to the CollectionInputFilter::isValid signature to match that of InputFilterInterface::isValid.
  • An update to some tests that used the EmailAddress validator; this validator uses constants deprecated in PHP 7.2, which raised errors during testing. These have each been updated to use the Digits validator instead, which is fully compatible.

Fixes #155.

When using the factory, the plugin managers used with the default filter
and validator chains should be used with all newly created inputs, as
these will have any custom services registered (vs. those that are in
the initially created inputs, which are unconfigured).

This means that:

- For cases where the instance was pulled from the `InputFilterManager`,
  we need to inject the filter and validator chains with the plugin
  managers pulled from the default instances; if the chain does not
  exist, we clone the default instance.
- For other instances, we need to simply clone the default filter and
  validator chains (which are empty, but have the configured filter and
  validator plugin managers).
Must conform to parent signature, even if `$context` optional argument
is ignored.
The `EmailAddress` validator is using a deprecated constant, which
causes errors in this test suite. As such, updated several tests to use
a different validator to ensure we can test on 7.2.
@weierophinney weierophinney merged commit 816b0fd into zendframework:master Dec 4, 2017
weierophinney added a commit that referenced this pull request Dec 4, 2017
weierophinney added a commit that referenced this pull request Dec 4, 2017
@weierophinney weierophinney deleted the hotfix/155-inputfilter-precedence branch December 4, 2017 20:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Version 2.8.5 broke backward compatibility for apigility
1 participant