Skip to content
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

Merged
merged 1 commit into from Mar 28, 2020
Merged

[BrowserKit] fixed missing post request parameters in file uploads #36181

merged 1 commit into from Mar 28, 2020

Conversation

codebay
Copy link
Contributor

@codebay codebay commented Mar 23, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
License MIT

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

@@ -134,6 +134,17 @@ public function testMultiPartRequestWithInvalidItem()
]);
}

public function testMultiPartRequestWithAdditonalParameters()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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));
Copy link
Member

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.

Copy link
Contributor Author

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.

@codebay
Copy link
Contributor Author

codebay commented Mar 27, 2020

Oops sorry rebased branch with master not 4.4 by accident, how do I reverse this?

@bobvandevijver
Copy link
Contributor

I would hard reset this branch on 4.4, and then chery-pick the relevant commits for this PR

@codebay
Copy link
Contributor Author

codebay commented Mar 27, 2020

Thank you for the advice, hopefully all fixed now.

@fabpot
Copy link
Member

fabpot commented Mar 28, 2020

Thank you @codebay.

@fabpot fabpot merged commit b580dd8 into symfony:4.4 Mar 28, 2020
@codebay codebay deleted the multipart-missing-textplain-parameters branch March 28, 2020 16:24
This was referenced Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants