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

BaseInputFilter::populate() calls resetValue() for missing arrayinputs #72

Merged

Conversation

BreiteSeite
Copy link
Contributor

hasValue returns true for ArrayInputs whether or not a value was provided via InputFilter::setData(). This can't be the expected behavior of this function.

However, i had to refactor the existing test BaseInputFilterTest::testPopulateSupportsArrayInputEvenIfDataMissing. I don't know the implications regarding BC because neither the docblock nor the commit message provided a useful use-case for this test-method.

Feedback is very welcome.

Thank you for considering my pull request.

@@ -513,7 +513,7 @@ protected function populate()
}

if ($input instanceof ArrayInput) {
$input->setValue([]);
$input->resetValue();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole if can be removed because ArrayInput is a child of Input

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thank you.

@Maks3w Maks3w added this to the 2.5.5 milestone Oct 6, 2015
@Maks3w Maks3w self-assigned this Oct 6, 2015
ArrayInput is a child of Input so no need for an additional check of
ArrayInput instance.
@Maks3w Maks3w modified the milestones: 2.5.5, 2.5.6 Oct 7, 2015
@Maks3w Maks3w merged commit 04c1742 into zendframework:master Oct 8, 2015
Maks3w added a commit that referenced this pull request Oct 8, 2015
Maks3w added a commit that referenced this pull request Oct 8, 2015
ArrayInput specific logic branch its not longer present and current Input tests are enough
Maks3w added a commit that referenced this pull request Oct 8, 2015
Maks3w added a commit that referenced this pull request Oct 8, 2015
@Maks3w Maks3w added the bug label Oct 8, 2015
@Maks3w
Copy link
Member

Maks3w commented Oct 8, 2015

Merged for next bugfix release. I don't consider this need to be backported to LTS

/cc @weierophinney

@BreiteSeite BreiteSeite deleted the fix-hasValue-for-arrayinputs branch February 15, 2018 23:01
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants