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] Throw exception for invalid form buttons name#31705

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:masterfromyceruto:rm_form_depr3
May 29, 2019
Merged
Show file tree
Hide file tree
Changes fromall 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
12 changes: 1 addition & 11 deletionssrc/Symfony/Component/Form/ButtonBuilder.php
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,17 +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 (isset($matches[1])) {
@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);
}
if (isset($matches[2])) {
@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);
}
}

// to be added in 5.0
// FormConfigBuilder::validateName($name);
FormConfigBuilder::validateName($name);
}

/**
Expand Down
2 changes: 2 additions & 0 deletionssrc/Symfony/Component/Form/CHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,8 @@ CHANGELOG
5.0.0
-----

* Using names for buttons that do not start with a letter, a digit, or an underscore throw an exception
* Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons throw an exception.
* removed the `ChoiceLoaderInterface` implementation in `CountryType`, `LanguageType`, `LocaleType` and `CurrencyType`

4.3.0
Expand Down
3 changes: 2 additions & 1 deletionsrc/Symfony/Component/Form/Tests/ButtonBuilderTest.php
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,7 +40,8 @@ public function testValidNames($name)
}

/**
* @group legacy
* @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
* @expectedExceptionMessage The name "button[]" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").
*/
public function testNameContainingIllegalCharacters()
{
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp