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] IntegerType: reject submitted non-integer numbers#30329

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
nicolas-grekas merged 1 commit intosymfony:3.4fromxabbuh:issue-10240
Feb 23, 2019

Conversation

@xabbuh
Copy link
Member

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#10240
LicenseMIT
Doc PR

@xabbuh
Copy link
MemberAuthor

Status: Needs work

{
$decimalSeparator =$this->getNumberFormatter()->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);

if (\is_string($value) &&false !==strpos($value,$decimalSeparator)) {
Copy link
Member

Choose a reason for hiding this comment

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

The transformation is invoked in reverse order inDateIntervalType when widget = integer, also in the model layer, so it could receive a real floating value here, isn't it?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Can you give an example? I am not sure that I understand what you mean.

Copy link
Member

Choose a reason for hiding this comment

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

if ('integer' ===$options['widget']) {
$childForm->addModelTransformer(
newReversedTransformer(
newIntegerToLocalizedStringTransformer()
)
);
}

Copy link
Member

Choose a reason for hiding this comment

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

UnlikeIntegerType this transformation is invoked for model layer in reversed order, so I guess we should deal with real float values here.

Copy link
Member

Choose a reason for hiding this comment

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

Basically, this is what I suggest:

if (false !==strpos((string)$value,$decimalSeparator)) {

Copy link
Member

Choose a reason for hiding this comment

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

Although, technically that should never happen becauseDateIntervalToArrayTransformer, so ignore my suggestion.

@nicolas-grekas
Copy link
Member

Thank you@xabbuh.

@nicolas-grekasnicolas-grekas merged commit6a43e74 intosymfony:3.4Feb 23, 2019
nicolas-grekas added a commit that referenced this pull requestFeb 23, 2019
…xabbuh)This PR was merged into the 3.4 branch.Discussion----------[Form] IntegerType: reject submitted non-integer numbers| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#10240| License       | MIT| Doc PR        |Commits-------6a43e74 IntegerType: reject submitted non-integer numbers
@xabbuhxabbuh deleted the issue-10240 branchFebruary 23, 2019 15:13
This was referencedMar 3, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@OskarStarkOskarStarkOskarStark left review comments

@ycerutoycerutoyceruto left review comments

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

6 participants

@xabbuh@nicolas-grekas@fabpot@OskarStark@yceruto@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp