-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[BrowserKit] fixed missing post request parameters in file uploads #36181
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
[BrowserKit] fixed missing post request parameters in file uploads #36181
Conversation
@@ -134,6 +134,17 @@ public function testMultiPartRequestWithInvalidItem() | |||
]); | |||
} | |||
|
|||
public function testMultiPartRequestWithAdditonalParameters() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function testMultiPartRequestWithAdditonalParameters() | |
public function testMultiPartRequestWithAdditionalParameters() |
@@ -75,7 +75,7 @@ private function getBodyAndExtraHeaders(Request $request): array | |||
$fields = $request->getParameters(); | |||
|
|||
if ($uploadedFiles = $this->getUploadedFiles($request->getFiles())) { | |||
$part = new FormDataPart($uploadedFiles); | |||
$part = new FormDataPart(array_merge($uploadedFiles, $fields)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, the order looks wrong. We should probably swap $fields and $uploadedFiles (to be consistent with the previous behavior). Also, can you add a test to avoid any regression in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot, I've fixed this and created a second test as suggested. BTW Enjoyed watching the pull request being reviewed online.
Oops sorry rebased branch with master not 4.4 by accident, how do I reverse this? |
I would hard reset this branch on 4.4, and then chery-pick the relevant commits for this PR |
Thank you for the advice, hopefully all fixed now. |
Thank you @codebay. |
Pull Request #35827 "[BrowserKit] Nested file array prevents uploading file" introduced a bug that had not been previously covered by unit tests for the component. Requests that include additional parameters with a file upload are not being included