Skip to content

Commit

Permalink
Fixing fileprg working with file collections (issue zendframework#6483)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafam31 committed Feb 18, 2015
1 parent 70d098c commit c481e74
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions library/Zend/Mvc/Controller/Plugin/FilePostRedirectGet.php
Expand Up @@ -217,8 +217,18 @@ protected function traverseInputs(InputFilterInterface $inputFilter, $values, $c
}

$input = $inputFilter->get($name);
if ($input instanceof InputFilterInterface && is_array($value)) {
$retVal = $this->traverseInputs($input, $value, $callback);
if ($input instanceof InputFilterInterface && is_array($value)) {

if ($input instanceof \Zend\InputFilter\CollectionInputFilter) {
$retVal = null;
foreach ($value as $k => $val) {
$retVal2 = $this->traverseInputs($input->getInputFilter(), $val, $callback);
if ($retVal2)
$retVal[$k] = $retVal2;
}
} else
$retVal = $this->traverseInputs($input, $value, $callback);

if (null !== $retVal) {
$returnValues[$name] = $retVal;
}
Expand Down Expand Up @@ -248,7 +258,7 @@ protected function getNonEmptyUploadData(InputFilterInterface $inputFilter, $dat
function ($input, $value) {
$messages = $input->getMessages();
if (is_array($value) && $input instanceof FileInput && empty($messages)) {
$rawValue = $input->getRawValue();
$rawValue = $value;
if (
(isset($rawValue['error']) && $rawValue['error'] !== UPLOAD_ERR_NO_FILE)
|| (isset($rawValue[0]['error']) && $rawValue[0]['error'] !== UPLOAD_ERR_NO_FILE)
Expand Down

0 comments on commit c481e74

Please sign in to comment.