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

[FrameworkBundle] Remove config deprecations#51428

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
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
8 changes: 8 additions & 0 deletionsUPGRADE-7.0.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,6 +202,14 @@ FrameworkBundle
* Remove the integration of Doctrine annotations, use native attributes instead
* Remove `EnableLoggerDebugModePass`, use argument `$debug` of HttpKernel's `Logger` instead
* Remove `AddDebugLogProcessorPass::configureLogger()`, use HttpKernel's `DebugLoggerConfigurator` instead
* Make the `framework.handle_all_throwables` config option default to `true`
* Make the `framework.php_errors.log` config option default to `true`
* Make the `framework.session.cookie_secure` config option default to `auto`
* Make the `framework.session.cookie_samesite` config option default to `lax`
* Make the `framework.session.handler_id` default to null if `save_path` is not set and to `session.handler.native_file` otherwise
* Make the `framework.uid.default_uuid_version` config option default to `7`
* Make the `framework.uid.time_based_uuid_version` config option default to `7`
* Make the `framework.validation.email_validation_mode` config option default to `html5`

HttpFoundation
--------------
Expand Down
8 changes: 8 additions & 0 deletionssrc/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,14 @@ CHANGELOG
* Remove the integration of Doctrine annotations, use native attributes instead
* Remove `EnableLoggerDebugModePass`, use argument `$debug` of HttpKernel's `Logger` instead
* Remove `AddDebugLogProcessorPass::configureLogger()`, use HttpKernel's `DebugLoggerConfigurator` instead
* Make the `framework.handle_all_throwables` config option default to `true`
* Make the `framework.php_errors.log` config option default to `true`
* Make the `framework.session.cookie_secure` config option default to `auto`
* Make the `framework.session.cookie_samesite` config option default to `lax`
* Make the `framework.session.handler_id` default to null if `save_path` is not set and to `session.handler.native_file` otherwise
* Make the `framework.uid.default_uuid_version` config option default to `7`
* Make the `framework.uid.time_based_uuid_version` config option default to `7`
* Make the `framework.validation.email_validation_mode` config option default to `html5`

6.4
---
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,15 +82,6 @@ public function getConfigTreeBuilder(): TreeBuilder
return $v;
})
->end()
->validate()
->always(function ($v) {
if (!isset($v['handle_all_throwables'])) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.handle_all_throwables" config option is deprecated. It will default to "true" in 7.0.');
}

return $v;
})
->end()
->fixXmlConfig('enabled_locale')
->children()
->scalarNode('secret')->end()
Expand DownExpand Up@@ -137,7 +128,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->scalarNode('error_controller')
->defaultValue('error_controller')
->end()
->booleanNode('handle_all_throwables')->info('HttpKernel will handle all kinds of \Throwable')->end()
->booleanNode('handle_all_throwables')->info('HttpKernel will handle all kinds of \Throwable')->defaultTrue()->end()
->end()
;

Expand DownExpand Up@@ -649,38 +640,15 @@ private function addRouterSection(ArrayNodeDefinition $rootNode): void
private function addSessionSection(ArrayNodeDefinition $rootNode): void
{
$rootNode
->validate()
->always(function (array $v): array {
if ($v['session']['enabled']) {
if (!\array_key_exists('cookie_secure', $v['session'])) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.session.cookie_secure" config option is deprecated. It will default to "auto" in 7.0.');
}

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

if (!\array_key_exists('handler_id', $v['session']) && !\array_key_exists('handler_id', $v['save_path'])) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting either "framework.session.handler_id" or "save_path" config options is deprecated; "handler_id" will default to null in 7.0 if "save_path" is not set and to "session.handler.native_file" otherwise.');
}
}

$v['session'] += [
'cookie_samesite' => null,
'handler_id' => 'session.handler.native_file',
'save_path' => '%kernel.cache_dir%/sessions',

Choose a reason for hiding this comment

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

whenhandler_id is non-null, save_path should still default to%kernel.cache_dir%/sessions, how can we deal with that?

Copy link
MemberAuthor

@alexandre-dauboisalexandre-dauboisAug 21, 2023
edited
Loading

Choose a reason for hiding this comment

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

I updated the condition:

if (!\array_key_exists('handler_id',$v['session'])) {$v['session']['handler_id'] =$v['session']['save_path'] ?'session.handler.native_file' :null;}elseif (null !==$v['session']['handler_id']) {$v['session']['save_path'] ??='%kernel.cache_dir%/sessions';}

Also updated changelog toMake the framework.session.save_path config option default to %kernel.cache_dir%/sessions if framework.session.handler_id is set or null otherwise

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I also added a call toinfo() to document this behavior

];

return $v;
})
->end()
->children()
->arrayNode('session')
->info('session configuration')
->canBeEnabled()
->children()
->scalarNode('storage_factory_id')->defaultValue('session.storage.factory.native')->end()
->scalarNode('handler_id')->end()
->scalarNode('handler_id')
->info('Defaults to using the native session handler, or to the native *file* session handler if "save_path" is not null.')
->end()
->scalarNode('name')
->validate()
->ifTrue(function ($v) {
Expand All@@ -694,14 +662,16 @@ private function addSessionSection(ArrayNodeDefinition $rootNode): void
->scalarNode('cookie_lifetime')->end()
->scalarNode('cookie_path')->end()
->scalarNode('cookie_domain')->end()
->enumNode('cookie_secure')->values([true, false, 'auto'])->end()
->enumNode('cookie_secure')->values([true, false, 'auto'])->defaultValue('auto')->end()
->booleanNode('cookie_httponly')->defaultTrue()->end()
->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->end()
->enumNode('cookie_samesite')->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->defaultValue('lax')->end()
->booleanNode('use_cookies')->end()
->scalarNode('gc_divisor')->end()
->scalarNode('gc_probability')->defaultValue(1)->end()
->scalarNode('gc_maxlifetime')->end()
->scalarNode('save_path')->end()
->scalarNode('save_path')
->info('Defaults to "%kernel.cache_dir%/sessions" if the "handler_id" option is not null')
->end()
->integerNode('metadata_update_threshold')
->defaultValue(0)
->info('seconds to wait between 2 session metadata updates')
Expand DownExpand Up@@ -1013,25 +983,6 @@ 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.');
}

if (isset($v['enable_annotations'])) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Option "enable_annotations" at "framework.validation" is deprecated. Use the "enable_attributes" option instead.');

if (!isset($v['enable_attributes'])) {
$v['enable_attributes'] = $v['enable_annotations'];
} else {
throw new LogicException('The "enable_annotations" and "enable_attributes" options at path "framework.validation" must not be both set. Only the "enable_attributes" option must be used.');
}
}

return $v;
})
->end()
->children()
->arrayNode('validation')
->info('validation configuration')
Expand All@@ -1047,7 +998,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
->validate()->castToArray()->end()
->end()
->scalarNode('translation_domain')->defaultValue('validators')->end()
->enumNode('email_validation_mode')->values(['html5', 'loose', 'strict'])->end()
->enumNode('email_validation_mode')->values(['html5', 'loose', 'strict'])->defaultValue('html5')->end()
->arrayNode('mapping')
->addDefaultsIfNotSet()
->fixXmlConfig('path')
Expand DownExpand Up@@ -1312,17 +1263,6 @@ private function addCacheSection(ArrayNodeDefinition $rootNode, callable $willBe
private function addPhpErrorsSection(ArrayNodeDefinition $rootNode): void
{
$rootNode
->validate()
->always(function (array $v): array {
if (!\array_key_exists('log', $v['php_errors'])) {
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.php_errors.log" config option is deprecated. It will default to "true" in 7.0.');

$v['php_errors']['log'] = $this->debug;
}

return $v;
})
->end()
->children()
->arrayNode('php_errors')
->info('PHP errors handling configuration')
Expand All@@ -1332,6 +1272,7 @@ private function addPhpErrorsSection(ArrayNodeDefinition $rootNode): void
->info('Use the application logger instead of the PHP logger for logging PHP errors.')
->example('"true" to use the default configuration: log all errors. "false" to disable. An integer bit field of E_* constants, or an array mapping E_* constants to log levels.')
->treatNullLike($this->debug)
->defaultTrue()
->beforeNormalization()
->ifArray()
->then(function (array $v): array {
Expand DownExpand Up@@ -2344,23 +2285,6 @@ 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')
Expand All@@ -2369,6 +2293,7 @@ private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIf
->children()
->enumNode('default_uuid_version')
->values([7, 6, 4, 1])
->defaultValue(7)
->end()
->enumNode('name_based_uuid_version')
->defaultValue(5)
Expand All@@ -2379,6 +2304,7 @@ private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIf
->end()
->enumNode('time_based_uuid_version')
->values([7, 6, 1])
->defaultValue(7)
->end()
->scalarNode('time_based_uuid_node')
->cannotBeEmpty()
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -181,7 +181,6 @@
use Symfony\Component\Validator\Mapping\Loader\PropertyInfoLoader;
use Symfony\Component\Validator\ObjectInitializerInterface;
use Symfony\Component\Validator\Validation;
use Symfony\Component\Validator\ValidatorBuilder;
use Symfony\Component\Webhook\Controller\WebhookController;
use Symfony\Component\WebLink\HttpHeaderSerializer;
use Symfony\Component\Workflow;
Expand DownExpand Up@@ -1232,10 +1231,15 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
$container->setParameter('session.storage.options', $options);

// session handler (the internal callback registered with PHP session management)
if (null === $config['handler_id']) {
if (null ===($config['handler_id'] ?? $config['save_path'] ?? null)) {
$config['save_path'] = null;
$container->setAlias('session.handler', 'session.handler.native');
} else {
$config['handler_id'] ??= 'session.handler.native_file';

if (!\array_key_exists('save_path', $config)) {
$config['save_path'] = '%kernel.cache_dir%/sessions';
}
$container->resolveEnvPlaceholders($config['handler_id'], null, $usedEnvs);

if ($usedEnvs || preg_match('#^[a-z]++://#', $config['handler_id'])) {
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -602,6 +602,7 @@ protected static function getBundleDefaultConfig()
'enabled' => true,
'endpoint' => null,
],
'email_validation_mode' => 'html5',
],
'annotations' => [
'enabled' => false,
Expand DownExpand Up@@ -635,11 +636,10 @@ protected static function getBundleDefaultConfig()
'session' => [
'enabled' => false,
'storage_factory_id' => 'session.storage.factory.native',
'handler_id' => 'session.handler.native_file',
'cookie_httponly' => true,
'cookie_samesite' => null,
'cookie_samesite' => 'lax',
'cookie_secure' => 'auto',
'gc_probability' => 1,
'save_path' => '%kernel.cache_dir%/sessions',
'metadata_update_threshold' => 0,
],
'request' => [
Expand DownExpand Up@@ -762,9 +762,9 @@ class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphor
],
'uid' => [
'enabled' => !class_exists(FullStack::class) && class_exists(UuidFactory::class),
'default_uuid_version' =>6,
'default_uuid_version' =>7,
'name_based_uuid_version' => 5,
'time_based_uuid_version' =>6,
'time_based_uuid_version' =>7,
],
'html_sanitizer' => [
'enabled' => !class_exists(FullStack::class) && class_exists(HtmlSanitizer::class),
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp