Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Form] Moved POST_MAX_SIZE validation from FormValidator to request handler#11924

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 2 commits intosymfony:2.3fromwebmozart:issue11877
Sep 24, 2014

Conversation

@webmozart
Copy link
Contributor

QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#11729,#11877
LicenseMIT
Doc PR-

Copy link
Member

Choose a reason for hiding this comment

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

this looks wrong to me. It should be marked as submitted but invalid IMO, as this case means that the client tried to submit it

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Should we submit it as empty form and suppress all other validation to prevent further error messages?

Copy link
Member

Choose a reason for hiding this comment

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

Well, submitting it as an empty form would make thing more complex in case of an edit form, as it would empty all fields rather than keeping the previous values.
I think we should mark the form as submitted, but without submitting the data for children (it could rely on the partial binding though)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Exactly. If we disable the$clearMissing parameter, as in PATCH requests, that should work. I don't really want to add a way for marking a form as submitted, that could be misused quite heavily.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Just to confirm: This means thatevery form with a matching request method (for example, if there are multiple POST forms on one page) will show the error and report being submitted. Is this desired?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Updated now.

@stofstof added the Form labelSep 20, 2014
@webmozart
Copy link
ContributorAuthor

ping @symfony/deciders

@fabpot
Copy link
Member

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

This code block is duplicated. So I guess one could refactor this. E.g. HttpFoundationRequestHandler extends NativeRequestHandler and then overwrites certains methods.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, there are a lot of similarities between the two request handlers. On the other hand, there are lots of tiny differences, so we'd end up with a pretty complex class + control flow if we remove all the duplications. Both classes are covered by the same test case, so if tests are added, both classes need to be adapted.

Feel free to try to remove the duplication in a new PR, there we can discuss how to do that well and whether it is really worth it.

@Tobion
Copy link
Contributor

👍

@Tobion
Copy link
Contributor

Oh wait, this is for 2.3? So I don't agree to deprecateForm/Extension/Validator/Util/ServerParams in a maintainance branch. Why is that necessary?

@webmozart
Copy link
ContributorAuthor

@Tobion Good point, thanks! I'll remove the deprecation note.

I movedServerParams to the globalUtil namespace since it's not just used for theValidatorExtension now.

@webmozart
Copy link
ContributorAuthor

Updated.

@fabpot
Copy link
Member

Thank you@webmozart.

@fabpotfabpot merged commit759ae1a intosymfony:2.3Sep 24, 2014
fabpot added a commit that referenced this pull requestSep 24, 2014
…o request handler (rpg600, webmozart)This PR was merged into the 2.3 branch.Discussion----------[Form] Moved POST_MAX_SIZE validation from FormValidator to request handler| Q             | A| ------------- | ---| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#11729,#11877| License       | MIT| Doc PR        | -Commits-------759ae1a [Form] Moved POST_MAX_SIZE validation from FormValidator to request handler4780210 [Form] Add a form error if post_max_size has been reached.
fabpot added a commit that referenced this pull requestSep 25, 2014
…ndationExtension for forward compatibility with 2.5 (webmozart)This PR was merged into the 2.3 branch.Discussion----------[Form] Removed constructor argument from FormTypeHttpFoundationExtension for forward compatibility with 2.5| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -This argument was introduced in#11924. No release was made of the 2.3 branch after merging that PR.Since a different constructor argument (`$requestHandler`) was added to FormTypeHttpFoundationExtension in the 2.5 branch, we cannot merge this forward in a BC fashion. For this reason, I removed the argument again.Commits-------6cbc862 [Form] Removed constructor argument from FormTypeHttpFoundationExtension for forward compatibility with 2.5
@rvanlaak
Copy link
Contributor

I've updated to2.5.5 and tested this implementation. The MAX_POST_SIZE error is added, but the CSRF-invalid error also gets added. So, it seems this check occurs after the CSRF-check (?).

Errors that are added via an event listener in the FormType do also still occur.

$builder->addEventListener(FormEvents::POST_SET_DATA, array($this, 'isFiletypeValid'));

So it seemsFormEvents::POST_SET_DATA is still triggered when the form already has an error. Does the latter event also trigger the CSRF-check?

@craue
Copy link
Contributor

I was curious to see that error and also tried triggering it by settingpost_max_size = 1M inphp.ini and uploading a larger file. But may it be with or without this PR, all I get is a plain PHP warning likeWarning: POST Content-Length of 4242283 bytes exceeds the limit of 1048576 bytes in Unknown on line 0 printed on top of the rendered page. So in which case is this error message meant to be shown?

fabpot added a commit that referenced this pull requestApr 12, 2020
…Dude)This PR was merged into the 5.1-dev branch.Discussion----------[Form] Deprecated unused old `ServerParams` util| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| Deprecations? | yes| Tickets       | ~| License       | MIT| Doc PR        | ~A left over after#11924 (comment), this class is unused since Symfony 2.3 ^^'. I've noticed it before but never took the time to submit a PR because this is very minor IMHO. But since this deprecation should not impact anyone, let's keep the codebase clean and remove it in 6.0.Commits-------e05e924 [Form] Deprecated unused old `ServerParams` util
symfony-splitter pushed a commit to symfony/form that referenced this pull requestApr 12, 2020
…Dude)This PR was merged into the 5.1-dev branch.Discussion----------[Form] Deprecated unused old `ServerParams` util| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| Deprecations? | yes| Tickets       | ~| License       | MIT| Doc PR        | ~A left over aftersymfony/symfony#11924 (comment), this class is unused since Symfony 2.3 ^^'. I've noticed it before but never took the time to submit a PR because this is very minor IMHO. But since this deprecation should not impact anyone, let's keep the codebase clean and remove it in 6.0.Commits-------e05e924c5a [Form] Deprecated unused old `ServerParams` util
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@webmozart@fabpot@Tobion@rvanlaak@craue@stof@rpg600

[8]ページ先頭

©2009-2025 Movatter.jp