8000 [FrameworkBundle] Deprecate not setting some options (uid, validation) by Jean-Beru · Pull Request #51357 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] Deprecate not setting some options (uid, validation) #51357

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
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
[FrameworkBundle] Deprecate not setting some options (uid, validation)
  • Loading branch information
Jean-Beru authored and nicolas-grekas committed Aug 17, 2023
commit aa3fbc5dcb6dd86a4b530d3f640820d1d29cc3a5
3 changes: 3 additions & 0 deletions UPGRADE-6.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ FrameworkBundle
* Deprecate not setting the `framework.session.cookie_secure` config option; it will default to `auto` in 7.0
* Deprecate not setting the `framework.session.cookie_samesite` config option; it will default to `lax` in 7.0
* Deprecate not setting the `framework.session.handler_id` config option; it will default to `session.handler.native_file` when `framework.session.save_path` is set or `null` otherwise in 7.0
* Deprecate not setting the `framework.uid.default_uuid_version` config option; it will default to `7` in 7.0
* Deprecate not setting the `framework.uid.time_based_uuid_version` config option; it will default to `7` in 7.0
* Deprecate not setting the `framework.validation.email_validation_mode` config option; it will default to `html5` in 7.0

HttpFoundation
--------------
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ CHANGELOG
* Deprecate not setting the `framework.session.cookie_secure` config option; it will default to `auto` in 7.0
* Deprecate not setting the `framework.session.cookie_samesite` config option; it will default to `lax` in 7.0
* Deprecate not setting the `framework.session.handler_id` config option; it will default to `session.handler.native_file` when `framework.session.save_path` is set or `null` otherwise in 7.0
* Deprecate not setting the `framework.uid.default_uuid_version` config option; it will default to `7` in 7.0
* Deprecate not setting the `framework.uid.time_based_uuid_version` config option; it will default to `7` in 7.0
* Deprecate not setting the `framework.validation.email_validation_mode` config option; it will default to `html5` in 7.0

6.3
---
Expand Down
EDBE
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,15 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e
private function addValidationSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone): void
{
$rootNode
->validate()
->always(function ($v) {
if ($v['validation']['enabled'] && !\array_key_exists('email_validation_mode', $v['validation'])) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.validation.email_validation_mode" config option is deprecated. It will default to "html5" in 7.0.');
}

return $v;
})
->end()
->children()
->arrayNode('validation')
->info('validation configuration')
Expand Down Expand Up @@ -2350,14 +2359,30 @@ private function addRateLimiterSection(ArrayNodeDefinition $rootNode, callable $
private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone): void
{
$rootNode
->validate()
->always(function ($v) {
if ($v['uid']['enabled']) {
if (!\array_key_exists('default_uuid_version', $v['uid'])) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.uid.default_uuid_version" config option is deprecated. It will default to "7" in 7.0.');
}

if (!\array_key_exists('time_based_uuid_version', $v['uid'])) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.uid.time_based_uuid_version" config option is deprecated. It will default to "7" in 7.0.');
}
}

$v['uid'] += ['default_uuid_version' => 6, 'time_based_uuid_version' => 6];

return $v;
})
->end()
->children()
->arrayNode('uid')
->info('Uid configuration')
->{$enableIfStandalone('symfony/uid', UuidFactory::class)}()
->addDefaultsIfNotSet()
->children()
->enumNode('default_uuid_version')
->defaultValue(6)
->values([7, 6, 4, 1])
->end()
->enumNode('name_based_uuid_version')
Expand All @@ -2368,7 +2393,6 @@ private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIf
->cannotBeEmpty()
->end()
->enumNode('time_based_uuid_version')
->defaultValue(6)
->values([7, 6, 1])
->end()
->scalarNode('time_based_uuid_node')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
],
'validation' => [
'enabled' => true,
'email_validation_mode' => 'html5',
],
'annotations' => false,
'serializer' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'validation' => [
'enabled' => true,
'enable_annotations' => true,
'email_validation_mode' => 'html5',
],
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'php_errors' => ['log' => true],
'property_info' => ['enabled' => true],
'validation' => [
'email_validation_mode' => 'html5',
'auto_mapping' => [
'App\\' => ['foo', 'bar'],
'Symfony\\' => ['a', 'b'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'validation' => [
'enabled' => true,
'enable_annotations' => true,
'email_validation_mode' => 'html5',
],
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'handle_all_throwables' => true,
'php_errors' => ['log' => true],
'validation' => [
'email_validation_mode' => 'html5',
'mapping' => [
'paths' => [
'%kernel.project_dir%/Fixtures/TestBundle/Resources/config/validation_mapping/files',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'secret' => 's3cr3t',
'validation' => [
'enabled' => true,
'email_validation_mode' => 'html5',
'static_method' => ['loadFoo', 'loadBar'],
],
]);
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'secret' => 's3cr3t',
'validation' => [
'enabled' => true,
'email_validation_mode' => 'html5',
'static_method' => false,
],
]);
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'handle_all_throwables' => true,
'php_errors' => ['log' => true],
'validation' => [
'email_validation_mode' => 'html5',
'translation_domain' => 'messages',
],
]);
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<framework:translator enabled="true" fallback="fr" logging="true" cache-dir="%kernel.cache_dir%/translations">
<framework:path>%kernel.project_dir%/Fixtures/translations</framework:path>
</framework:translator>
<framework:validation enabled="true" />
<framework:validation enabled="true" email-validation-mode="html5" />
<framework:annotations enabled="false" />
<framework:php-errors log="true" />
<framework:serializer enabled="true" enable-annotations="true" name-converter="serializer.name_converter.camel_case_to_snake_case" circular-reference-handler="my.circular.reference.handler" max-depth-handler="my.max.depth.handler">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<framework:config secret="s3cr3t" http-method-override="false" handle-all-throwables="true">
<framework:annotations enabled="false" />
<framework:php-errors log="true" />
<framework:validation enabled="true" enable-annotations="true" />
<framework:validation enabled="true" enable-annotations="true" email-validation-mode="html5" />
</framework:config>

<services>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<framework:annotations enabled="false" />
<framework:php-errors log="true" />
<framework:property-info enabled="true" />
<framework:validation>
<framework:validation email-validation-mode="html5">
<framework:auto-mapping namespace="App\">
<framework:service>foo</framework:service>
<framework:service>bar</framework:service>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<framework:config secret="s3cr3t" http-method-override="false" handle-all-throwables="true">
<framework:annotations enabled="true" />
<framework:php-errors log="true" />
<framework:validation enabled="true" enable-annotations="true" />
<framework:validation enabled="true" enable-annotations="true" email-validation-mode="html5" />
</framework:config>

<services>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<framework:config http-method-override="false" handle-all-throwables="true">
<framework:annotations enabled="false" />
<framework:php-errors log="true" />
<framework:validation>
<framework:validation email-validation-mode="html5">
<framework:mapping>
<framework:path>%kernel.project_dir%/Fixtures/TestBundle/Resources/config/validation_mapping/files</framework:path>
<framework:path>%kernel.project_dir%/Fixtures/TestBundle/Resources/config/validation_mapping/validation.yml</framework:path>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<framework:config secret="s3cr3t" http-method-override="false" handle-all-throwables="true">
<framework:annotations enabled="false" />
<framework:php-errors log="true" />
<framework:validation enabled="true">
<framework:validation enabled="true" email-validation-mode="html5">
<framework:static-method>loadFoo</framework:static-method>
<framework:static-method>loadBar</framework:static-method>
</framework:validation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<framework:config secret="s3cr3t" http-method-override="false" handle-all-throwables="true">
<framework:annotations enabled="false" />
<framework:php-errors log="true" />
<framework:validation enabled="true" static-method="false" />
<framework:validation enabled="true" static-method="false" email-validation-mode="html5" />
</framework:config>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<framework:config http-method-override="false" handle-all-throwables="true">
<framework:annotations enabled="false" />
<framework:php-errors log="true" />
<framework:validation translation-domain="messages" />
<framework:validation translation-domain="messages" email-validation-mode="html5" />
</framework:config>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ framework:
paths: ['%kernel.project_dir%/Fixtures/translations']
validation:
enabled: true
email_validation_mode: html5
annotations: false
serializer:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ framework:
validation:
enabled: true
enable_annotations: true
email_validation_mode: html5

services:
validator.alias:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ framework:
log: true
property_info: { enabled: true }
validation:
email_validation_mode: html5
auto_mapping:
'App\': ['foo', 'bar']
'Symfony\': ['a', 'b']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ framework:
validation:
enabled: true
enable_annotations: true
email_validation_mode: html5

services:
validator.alias:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ framework:
php_errors:
log: true
validation:
email_validation_mode: html5
mapping:
paths:
- "%kernel.project_dir%/Fixtures/TestBundle/Resources/config/validation_mapping/files"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ framework:
secret: s3cr3t
validation:
enabled: true
email_validation_mode: html5
static_method: [loadFoo, loadBar]
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ framework:
secret: s3cr3t
validation:
enabled: true
email_validation_mode: html5
static_method: false
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ framework:
php_errors:
log: true
validation:
email_validation_mode: html5
translation_domain: messages
57AE
Original file line numberDiff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ imports:

framework:
http_method_override: false
uid: ~
uid:
default_uuid_version: 7
time_based_uuid_version: 7
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ framework:
handle_all_throwables: true
secret: test
router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml", utf8: true }
validation: { enabled: true, enable_annotations: true }
validation: { enabled: true, enable_annotations: true, email_validation_mode: html5 }
csrf_protection: true
form:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ framework:
handle_all_throwables: true
secret: test
router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml", utf8: true }
validation: { enabled: true, enable_annotations: true }
validation: { enabled: true, enable_annotations: true, email_validation_mode: html5 }
csrf_protection: true
form:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ framework:
handle_all_throwables: true
secret: test
router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml", utf8: true }
validation: { enabled: true, enable_annotations: true }
validation: { enabled: true, enable_annotations: true, email_validation_mode: html5 }
assets: ~
csrf_protection: true
form:
Expand Down
0