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

add missing double-quotes to extra_fields output message#28840

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

Conversation

@danielkay
Copy link

QA
Branch?2.8
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsN/A
LicenseMIT
Doc PRN/A

When using the extra_fields_message option on FormTypes to include the extra_fields items in the message, the output included some superfluous (or, perhaps, missing?) quotes. This resulted in some strange output:This form should not contain extra fields: notes1\", \"notes2\", \"notes3.

This PR removes the quotes and instead implodes the extra_fields array using merely ', ' as the glue, resulting in the output:This form should not contain extra fields: notes1, notes2, notes3.

@danielkaydanielkay changed the titleuremove superfluous double-quotes from extra_fields output messageremove superfluous double-quotes from extra_fields output messageOct 12, 2018
@fabpot
Copy link
Member

I think the intention was to have something likeThis form should not contain extra fields: "notes1", "notes2", "notes3"

Kocal, sstok, ogizanagi, and fancyweb reacted with thumbs up emoji

@zanbaldwin
Copy link
Member

Congrats on your first Symfony pull request! 🎉

For the merger team: an alternative could be add the extra quotes before and after the imploded fields, but I agree with the style proposed (it's unlikely that form field names will contain commas, and the extra quotes get escaped in APIs using JSON format making it look ugly).

Status: Reviewed

danielkay reacted with hooray emoji

@danielkay
Copy link
Author

@fabpot Unfortunately it isn't doing so... I feel we should take the code one way or the other - would with quotes or without quotes be better? Without the first and last quote feels weird...

Copy link
Contributor

@ro0NLro0NL left a comment
edited
Loading

Choose a reason for hiding this comment

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

you can already hijack the format by submitting e.g.'foo","bar' => 'val', so not caring about quotes here seems fine.

@xabbuhxabbuh added the Form labelOct 15, 2018
@fabpot
Copy link
Member

I would add the missing quotes instead of removing them to be consistent with the way we display other error messages.

danielkay reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas added this to the2.8 milestoneOct 17, 2018
@danielkaydanielkayforce-pushed thefix/erroneous-quotes-in-extra_fields-output branch fromade8f68 to2379b40CompareOctober 17, 2018 11:29
@danielkaydanielkay changed the titleremove superfluous double-quotes from extra_fields output messageadd missing double-quotes to extra_fields output messageOct 17, 2018
@danielkay
Copy link
Author

added missing quotes as per suggestion from@fabpot

ro0NL reacted with thumbs up emoji

}else {
$this->buildViolation($config->getOption('extra_fields_message'))
->setParameter('{{ extra_fields }}',implode('", "',array_keys($form->getExtraData())))
->setParameter('{{ extra_fields }}','"'.implode(',',array_keys($form->getExtraData())).'"')
Copy link
Contributor

Choose a reason for hiding this comment

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

here'", "' should remain as glue also right

Copy link
Author

Choose a reason for hiding this comment

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

Ooops, well spotted 👍

@danielkaydanielkayforce-pushed thefix/erroneous-quotes-in-extra_fields-output branch 3 times, most recently from3ef528c tod1d2c48CompareOctober 17, 2018 12:05
@fabpotfabpotforce-pushed thefix/erroneous-quotes-in-extra_fields-output branch fromd1d2c48 to9e74141CompareOctober 17, 2018 13:53
@fabpot
Copy link
Member

Thank you@danielkay.

danielkay reacted with heart emoji

@fabpotfabpot merged commit9e74141 intosymfony:2.8Oct 17, 2018
fabpot added a commit that referenced this pull requestOct 17, 2018
…danielkay)This PR was squashed before being merged into the 2.8 branch (closes#28840).Discussion----------add missing double-quotes to extra_fields output message| Q             | A| ------------- | ---| Branch?       | 2.8| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | N/A| License       | MIT| Doc PR        | N/AWhen using the extra_fields_message option on FormTypes to include the extra_fields items in the message, the output included some superfluous (or, perhaps, missing?) quotes. This resulted in some strange output: `This form should not contain extra fields: notes1\", \"notes2\", \"notes3`.This PR removes the quotes and instead implodes the extra_fields array using merely ', ' as the glue, resulting in the output: `This form should not contain extra fields: notes1, notes2, notes3`.Commits-------9e74141 add missing double-quotes to extra_fields output message
This was referencedNov 3, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

+1 more reviewer

@ro0NLro0NLro0NL approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

2.8

Development

Successfully merging this pull request may close these issues.

7 participants

@danielkay@fabpot@zanbaldwin@ro0NL@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp