8000 [Form] allow button names to start with uppercase letter by xabbuh · Pull Request #34448 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] allow button names to start with uppercase letter #34448

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
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UPGRADE-4.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Form
----

* Using the `format` option of `DateType` and `DateTimeType` when the `html5` option is enabled is deprecated.
* Using names for buttons that do not start with a lowercase letter, a digit, or an underscore is deprecated and will lead to an
* Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated and will lead to an
exception in 5.0.
* Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons is deprecated and
will lead to an exception in 5.0.
Expand Down
2 changes: 1 addition & 1 deletion UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Form
----

* Removed support for using the `format` option of `DateType` and `DateTimeType` when the `html5` option is enabled.
* Using names for buttons that do not start with a lowercase letter, a digit, or an underscore leads to an exception.
* Using names for buttons that do not start with a letter, a digit, or an underscore leads to an exception.
* Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons leads to an
exception.
* Using the `date_format`, `date_widget`, and `time_widget` options of the `DateTimeType` when the `widget` option is
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/ButtonBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function __construct(?string $name, array $options = [])
$this->name = $name;
$this->options = $options;

if (preg_match('/^([^a-z0-9_].*)?(.*[^a-zA-Z0-9_\-:].*)?$/D', $name, $matches)) {
if (preg_match('/^([^a-zA-Z0-9_].*)?(.*[^a-zA-Z0-9_\-:].*)?$/D', $name, $matches)) {
if (isset($matches[1])) {
@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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CHANGELOG

* added a `symbol` option to the `PercentType` that allows to disable or customize the output of the percent character
* Using the `format` option of `DateType` and `DateTimeType` when the `html5` option is enabled is deprecated.
* Using names for buttons that do not start with a lowercase letter, a digit, or an underscore is deprecated and will lead to an
* Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated and will lead to an
exception in 5.0.
* Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons is deprecated and
will lead to an exception in 5.0.
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Tests/ButtonBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ public function testNameContainingIllegalCharacters()
$this->assertInstanceOf('\Symfony\Component\Form\ButtonBuilder', new ButtonBuilder('button[]'));
}

/**
* @group legacy
*/
public function testNameStartingWithIllegalCharacters()
{
$this->assertInstanceOf('\Symfony\Component\Form\ButtonBuilder', new ButtonBuilder('Button'));
}

public function getInvalidNames()
{
return [
Expand Down
0