10000 [Form] Fix form value merging involving file upload, collection & checkbox by priyadi · Pull Request #54324 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Fix form value merging involving file upload, collection & checkbox #54324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: 5.4
Choose a base branch
from
Prev Previous commit
Next Next commit
cs
  • Loading branch information
priyadi committed Mar 24, 2024
commit aec4b56cc04846836d255f0a3eab258b2ec04bab
4 changes: 3 additions & 1 deletion src/Symfony/Component/Form/Util/ParamFilesMerger.php
574E
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ParamFilesMerger
private array $files;

/**
* @param array $path The path to the current element, empty means the root
* @param array $path The path to the current element, empty means the root
* @param array $params The parameters
* @param array $files The files
*/
Expand All @@ -49,11 +49,13 @@ public function getResult()
} elseif (\is_array($filesValue)) {
return $this->getResultArray($paramsValue, $filesValue);
}

return $paramsValue; // params has the precedence
} else { // $paramsValue has a non-array value
if (self::isFileUpload($filesValue)) {
return $filesValue; // if the array is a file upload field, it has the precedence
}

return $paramsValue;
}
}
Expand Down
0