This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Collection attempts to access object
property on $this->targetElement
#6263
Comments
Closed
It has come to my attention that the same issue appears in one of the unit tests of |
Duplicate of #4482 ? |
adamlundrigan
added a commit
to adamlundrigan/zf2
that referenced
this issue
Nov 15, 2014
adamlundrigan
pushed a commit
to adamlundrigan/zf2
that referenced
this issue
Nov 15, 2014
adamlundrigan
pushed a commit
to adamlundrigan/zf2
that referenced
this issue
Nov 15, 2014
Ocramius
pushed a commit
that referenced
this issue
Nov 19, 2014
Ocramius
pushed a commit
that referenced
this issue
Nov 19, 2014
Fixed via #6880, thanks! |
Ocramius
added a commit
that referenced
this issue
Dec 28, 2014
Note that attribution will be given only as a comment to the commit, since rebasing/squashing the commits to avoid changes to unaffected code-paths is problematic. If this doesn't match expectations, then please ask for a revert and send the test code in a separate pull request.
Ocramius
added a commit
that referenced
this issue
Dec 28, 2014
…-collection-element' into develop Close #6298
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This issue applies to
Zend\Form\Element\Collection
. When setting the target element of the collection, aZend\Form\ElementInterface
is expected (onCollection::setTargetElement()
). This promotes the use of regular form elements, likeZend\Form\Element\Text
to be used as a target element.However, when using e.g.
Text
as a target element, binding anArrayObject
with a few values set and setting no hydrator, theCollection::extract()
method attempts to access$this->targetElement->object
, which is only defined if$this->targetElement
is aZend\Form\Fieldset
. To clarify, consider the following test case:This case will trigger a fatal error.
I suggest to add a check on whether
$this->targetElement
is aFieldset
and when everything fails just copying the value, assuming no hydration is needed. I am submitting a patch soon.The text was updated successfully, but these errors were encountered: