8000 [Form] added a missing check (the code calls isset() and unset() and … · yktd26/symfony@b2efdcb · GitHub
[go: up one dir, main page]

Skip to content

Commit b2efdcb

Browse files
committed
[Form] added a missing check (the code calls isset() and unset() and so the data must implements ArrayAccess and Traversable)
1 parent c3a060e commit b2efdcb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ public function preSetData(DataEvent $event)
7979
$data = array();
8080
}
8181

82-
if (!is_array($data) && !$data instanceof \Traversable) {
83-
throw new UnexpectedTypeException($data, 'array or \Traversable');
82+
if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {
83+
throw new UnexpectedTypeException($data, 'array or \Traversable or \ArrayAccess');
8484
}
8585

8686
// First remove all rows
@@ -105,8 +105,8 @@ public function preBind(DataEvent $event)
105105
$data = array();
106106
}
107107

108-
if (!is_array($data) && !$data instanceof \Traversable) {
109-
throw new UnexpectedTypeException($data, 'array or \Traversable');
108+
if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {
109+
throw new UnexpectedTypeException($data, 'array or \Traversable or \ArrayAccess');
110110
}
111111

112112
// Remove all empty rows
@@ -139,8 +139,8 @@ public function onBindNormData(FilterDataEvent $event)
139139
$data = array();
140140
}
141141

142-
if (!is_array($data) && !$data instanceof \Traversable) {
143-
throw new UnexpectedTypeException($data, 'array or \Traversable');
142+
if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {
143+
throw new UnexpectedTypeException($data, 'array or \Traversable or \ArrayAccess');
144144
}
145145

146146
if ($this->allowDelete) {

0 commit comments

Comments
 (0)
0