Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] deprecate using invalid names for buttons #28969

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

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Oct 24, 2018

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets #28964
License MIT
Doc PR

@xabbuh xabbuh added this to the next milestone Oct 24, 2018
@xabbuh xabbuh force-pushed the issue-28964 branch 3 times, most recently from 21c1170 to b9cd039 Compare October 25, 2018 12:06
@@ -63,6 +63,18 @@ public function __construct(?string $name, array $options = array())

$this->name = $name;
$this->options = $options;

if (\preg_match('/^([^a-z0-9_].*)?(.*[^a-zA-Z0-9_\-:].*)?$/D', $name, $matches)) {
Copy link
Member

Choose a reason for hiding this comment

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

Just asking: is this validating the value of the name HTML attribute of <button> elements ... or is this a Symfony thing? I say this because HTML allows for example : as the first character of name.

Copy link
Member Author

Choose a reason for hiding this comment

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

It affects both. The internal name is used to generate the HTML attribute value. Buttons will then behave the same as "normal" form types already behave.

@xabbuh xabbuh force-pushed the issue-28964 branch 2 times, most recently from 8c3fbf4 to b0af2bb Compare January 5, 2019 17:12
@xabbuh
Copy link
Member Author

xabbuh commented Feb 21, 2019

ping @symfony/deciders :)

@fabpot
Copy link
Member

fabpot commented Feb 21, 2019

Thank you @xabbuh.

@fabpot fabpot merged commit 405aa54 into symfony:master Feb 21, 2019
fabpot added a commit that referenced this pull request Feb 21, 2019
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Form] deprecate using invalid names for buttons

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #28964
| License       | MIT
| Doc PR        |

Commits
-------

405aa54 deprecate using invalid names for buttons
@xabbuh xabbuh deleted the issue-28964 branch February 21, 2019 07:49
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.3 Apr 30, 2019
@fabpot fabpot mentioned this pull request May 9, 2019
symfony-splitter pushed a commit to symfony/form that referenced this pull request May 29, 2019
…eruto)

This PR was merged into the 5.0-dev branch.

Discussion
----------

[Form] Throw exception for invalid form buttons name

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

See symfony/symfony#28969

Commits
-------

6deeaa42ae Validating form buttons name
nicolas-grekas added a commit that referenced this pull request May 29, 2019
…eruto)

This PR was merged into the 5.0-dev branch.

Discussion
----------

[Form] Throw exception for invalid form buttons name

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

See #28969

Commits
-------

6deeaa4 Validating form buttons name
fabpot added a commit that referenced this pull request Sep 25, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

[Form] Names for buttons should start with lowercase

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

This fix changes the messages related to the changes in #28969 - the message used to state that names should start with a letter, a digit ... - so I got a confusing message:

```
Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("Search" given).'
```

Which made me find the message, look at the regex that was used, and work out that actually it should start with a lowercase letter, and hence this PR - where I assume there is a reason that the name must start with lowercase letters.

Commits
-------

f65524e Names for buttons should start with lowercase
symfony-splitter pushed a commit to symfony/form that referenced this pull request Sep 25, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

[Form] Names for buttons should start with lowercase

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

This fix changes the messages related to the changes in symfony/symfony#28969 - the message used to state that names should start with a letter, a digit ... - so I got a confusing message:

```
Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("Search" given).'
```

Which made me find the message, look at the regex that was used, and work out that actually it should start with a lowercase letter, and hence this PR - where I assume there is a reason that the name must start with lowercase letters.

Commits
-------

f65524e4e0 Names for buttons should start with lowercase
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.

7 participants