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

Appearance settings

Commit d04fdee

Browse filesBrowse files
committed
bug #32335 [Form] Names for buttons should start with lowercase (mcfedr)
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
2 parents 29a54c5 + f65524e commit d04fdee
Copy full SHA for d04fdee

5 files changed

+12-4Lines changed: 12 additions & 4 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎UPGRADE-4.3.md‎

Copy file name to clipboardExpand all lines: UPGRADE-4.3.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Form
9696
----
9797

9898
* Using the `format` option of `DateType` and `DateTimeType` when the `html5` option is enabled is deprecated.
99-
* Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated and will lead to an
99+
* Using names for buttons that do not start with a lowercase letter, a digit, or an underscore is deprecated and will lead to an
100100
exception in 5.0.
101101
* Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons is deprecated and
102102
will lead to an exception in 5.0.
Collapse file

‎UPGRADE-5.0.md‎

Copy file name to clipboardExpand all lines: UPGRADE-5.0.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Form
110110
----
111111

112112
* Removed support for using the `format` option of `DateType` and `DateTimeType` when the `html5` option is enabled.
113-
* Using names for buttons that do not start with a letter, a digit, or an underscore leads to an exception.
113+
* Using names for buttons that do not start with a lowercase letter, a digit, or an underscore leads to an exception.
114114
* Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons leads to an
115115
exception.
116116
* Using the `date_format`, `date_widget`, and `time_widget` options of the `DateTimeType` when the `widget` option is
Collapse file

‎src/Symfony/Component/Form/ButtonBuilder.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ButtonBuilder.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function __construct(?string $name, array $options = [])
6363

6464
if (preg_match('/^([^a-z0-9_].*)?(.*[^a-zA-Z0-9_\-:].*)?$/D', $name, $matches)) {
6565
if (isset($matches[1])) {
66-
@trigger_error(sprintf('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 ("%s" given).', $name), E_USER_DEPRECATED);
66+
@trigger_error(sprintf('Using names for buttons that do not start with a lowercase letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("%s" given).', $name), E_USER_DEPRECATED);
6767
}
6868
if (isset($matches[2])) {
6969
@trigger_error(sprintf('Using names for buttons that do not contain only letters, digits, underscores ("_"), hyphens ("-") and colons (":") ("%s" given) is deprecated since Symfony 4.3 and will throw an exception in 5.0.', $name), E_USER_DEPRECATED);
Collapse file

‎src/Symfony/Component/Form/CHANGELOG.md‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CHANGELOG
66

77
* added a `symbol` option to the `PercentType` that allows to disable or customize the output of the percent character
88
* Using the `format` option of `DateType` and `DateTimeType` when the `html5` option is enabled is deprecated.
9-
* Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated and will lead to an
9+
* Using names for buttons that do not start with a lowercase letter, a digit, or an underscore is deprecated and will lead to an
1010
exception in 5.0.
1111
* Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons is deprecated and
1212
will lead to an exception in 5.0.
Collapse file

‎src/Symfony/Component/Form/Tests/ButtonBuilderTest.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/ButtonBuilderTest.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ public function testNameContainingIllegalCharacters()
4747
$this->assertInstanceOf('\Symfony\Component\Form\ButtonBuilder', new ButtonBuilder('button[]'));
4848
}
4949

50+
/**
51+
* @group legacy
52+
*/
53+
public function testNameStartingWithIllegalCharacters()
54+
{
55+
$this->assertInstanceOf('\Symfony\Component\Form\ButtonBuilder', new ButtonBuilder('Button'));
56+
}
57+
5058
public function getInvalidNames()
5159
{
5260
return [

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.