Skip to content

Commit 6b03342

Browse files
committed
feature #1217 Upgrade to Symfony 5.3 (javiereguiluz, nicolas-grekas)
This PR was merged into the main branch. Discussion ---------- Upgrade to Symfony 5.3 For now, it's Symfony 5.3 RC1, but we'll keep updating this branch until 5.3 stable. ----- Things that I found while upgrading: ### Missing UPGRADE guide entry? In the UPGRADE guide (https://github.com/symfony/symfony/blob/5.3/UPGRADE-5.3.md) we don't even mention `enable_csrf`, but this change is needed in `config/packages/security.yaml`: Replace this: ```yaml form_login: csrf_token_generator: security.csrf.token_manager ``` by this: ```yaml form_login: enable_csrf: true ``` ----- ### Unexpected failures The upgrade guide mentions this: ``` PropertyInfo: Deprecated the Type::getCollectionKeyType() and Type::getCollectionValueType() methods, use Type::getCollectionKeyTypes() and Type::getCollectionValueTypes() instead ``` But we have these test failures: ``` App\Tests\Controller\Admin\BlogControllerTest::testAdminNewPost Error: Call to undefined method Symfony\Component\PropertyInfo\Type::getCollectionValueTypes() demo/vendor/symfony/validator/Mapping/Loader/PropertyInfoLoader.php:122 demo/vendor/symfony/validator/Mapping/Loader/LoaderChain.php:54 demo/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php:101 demo/vendor/symfony/validator/Validator/RecursiveValidator.php:76 demo/vendor/symfony/validator/Validator/TraceableValidator.php:50 demo/vendor/symfony/form/Extension/Validator/ValidatorTypeGuesser.php:265 demo/vendor/symfony/form/Extension/Validator/ValidatorTypeGuesser.php:38 demo/vendor/symfony/form/FormTypeGuesserChain.php:47 demo/vendor/symfony/form/FormTypeGuesserChain.php:93 demo/vendor/symfony/form/FormTypeGuesserChain.php:48 demo/vendor/symfony/form/FormFactory.php:84 demo/vendor/symfony/form/FormBuilder.php:97 demo/vendor/symfony/form/FormBuilder.php:244 demo/vendor/symfony/form/FormBuilder.php:195 demo/vendor/symfony/form/FormFactory.php:28 demo/vendor/symfony/framework-bundle/Controller/AbstractController.php:359 demo/src/Controller/Admin/BlogController.php:78 demo/vendor/symfony/http-kernel/HttpKernel.php:157 demo/vendor/symfony/http-kernel/HttpKernel.php:79 demo/vendor/symfony/http-kernel/Kernel.php:196 demo/vendor/symfony/http-kernel/HttpKernelBrowser.php:63 demo/vendor/symfony/framework-bundle/KernelBrowser.php:159 demo/vendor/symfony/browser-kit/AbstractBrowser.php:402 demo/tests/Controller/Admin/BlogControllerTest.php:89 ``` ----- ### Unexpected direct deprecations I see the following "direct deprecation" notices, but I don't know how they can be "direct deprecations". We don't use any of these in our code: ``` Remaining direct deprecation notices (7) 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\SodiumPasswordEncoder" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\SodiumPasswordHasher" instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface" class is deprecated, use "Symfony\Component\PasswordHasher\PasswordHasherInterface" instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\SelfSaltingEncoderInterface" interface is deprecated, use "Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface" on hasher implementations that deal with salts instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\Pbkdf2PasswordEncoder" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\Pbkdf2PasswordHasher" instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\BasePasswordEncoder" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\CheckPasswordLengthTrait" instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher" instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\MigratingPasswordEncoder" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\MigratingPasswordHasher" instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command ``` ----- ### Indirect deprecations to fix? There are still these "indirect deprecations". Are we missing some dependency updates ... or are these really deprecations pending to be fixed? ``` Remaining indirect deprecation notices (24) 19x: Since symfony/security-core 5.3: Not implementing method "loadUserByIdentifier()" in user provider "Symfony\Bridge\Doctrine\Security\User\EntityUserProvider" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0. 4x in BlogControllerTest::testAccessDeniedForRegularUsers from App\Tests\Controller\Admin 4x in BlogControllerTest::testNewComment from App\Tests\Controller 2x in BlogControllerTest::testAdminDeletePost from App\Tests\Controller\Admin 2x in UserControllerTest::testEditUser from App\Tests\Controller 2x in UserControllerTest::testChangePassword from App\Tests\Controller 1x in BlogControllerTest::testAdminBackendHomePage from App\Tests\Controller\Admin 1x in BlogControllerTest::testAdminNewPost from App\Tests\Controller\Admin 1x in BlogControllerTest::testAdminNewDuplicatedPost from App\Tests\Controller\Admin 1x in BlogControllerTest::testAdminShowPost from App\Tests\Controller\Admin 1x in BlogControllerTest::testAdminEditPost from App\Tests\Controller\Admin 4x: Since symfony/http-foundation 5.3: "Symfony\Component\HttpFoundation\RequestStack::getMasterRequest()" is deprecated, use "getMainRequest()" instead. 4x in BlogControllerTest::testAccessDeniedForRegularUsers from App\Tests\Controller\Admin 1x: The "DAMA\DoctrineTestBundle\Doctrine\DBAL\AbstractStaticDriverV2" class implements "Doctrine\DBAL\Driver\ExceptionConverterDriver" that is deprecated. 1x in PHPUnitExtension::executeBeforeFirstTest from DAMA\DoctrineTestBundle\PHPUnit Other deprecation notices (18) 7x: Since symfony/security-bundle 5.3: The "security.password_encoder" service is deprecated, use "security.user_password_hasher" instead. 2x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 2x in AddUserCommandTest::testCreateUserInteractive from App\Tests\Command 2x in UserControllerTest::testChangePassword from App\Tests\Controller 1x in UserControllerTest::testAccessDeniedForAnonymousUsers from App\Tests\Controller 7x: Since symfony/security-bundle 5.3: The "security.encoder_factory.generic" service is deprecated, use "security.password_hasher_factory" instead. 2x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 2x in AddUserCommandTest::testCreateUserInteractive from App\Tests\Command 2x in UserControllerTest::testChangePassword from App\Tests\Controller 1x in UserControllerTest::testAccessDeniedForAnonymousUsers from App\Tests\Controller 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\UserPasswordEncoder" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher" instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface" interface is deprecated, use "Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface" instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\EncoderFactory" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory" instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command 1x: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface" instead. 1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command ``` Commits ------- 2a9c975 Serializable is banned 58822bd composer up b0f5db5 Update assets/ cfeb771 Update code for 5.3 a410db9 Better constraints b6d91b2 Removed most deprecations 997ce81 Updated to Symfony 5.3 RC1
2 parents 4b8f9fa + 2a9c975 commit 6b03342

File tree

105 files changed

+2893
-2882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2893
-2882
lines changed

.env

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ APP_SECRET=2ca64f8d83b9e89f5f19d672841d6bb8
2222

2323
###> doctrine/doctrine-bundle ###
2424
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
25-
# For a MySQL database, use: "mysql://db_user:[email protected]:3306/db_name"
26-
# For a PostgreSQL database, use: "postgresql://db_user:[email protected]:5432/db_name?serverVersion=11&charset=utf8"
2725
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
26+
#
2827
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database.sqlite
28+
# DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7",
29+
# DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8"
2930
###< doctrine/doctrine-bundle ###
3031

3132
###> symfony/mailer ###

.env.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ KERNEL_CLASS='App\Kernel'
33
APP_SECRET='$ecretf0rt3st'
44
SYMFONY_DEPRECATIONS_HELPER=999999
55
PANTHER_APP_ENV=panther
6+
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
67
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database_test.sqlite

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555
- name: "Composer install"
5656
id: install
57-
run: composer install --no-interaction --no-progress --no-scripts
57+
run: composer install --no-interaction --no-progress
5858

5959
- name: Lint YAML files
6060
if: always() && steps.install.outcome == 'success'

assets/js/admin.js renamed to assets/admin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import '../scss/admin.scss';
1+
import './styles/admin.scss';
22
import 'eonasdan-bootstrap-datetimepicker';
33
import 'typeahead.js';
44
import Bloodhound from "bloodhound-js";
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import '../scss/app.scss';
1+
import './styles/app.scss';
22

33
// loads the Bootstrap jQuery plugins
44
import 'bootstrap-sass/assets/javascripts/bootstrap/transition.js';
@@ -9,7 +9,10 @@ import 'bootstrap-sass/assets/javascripts/bootstrap/modal.js';
99
import 'jquery'
1010

1111
// loads the code syntax highlighting library
12-
import './highlight.js';
12+
import './js/highlight.js';
1313

1414
// Creates links to the Symfony documentation
15-
import './doclinks.js';
15+
import './js/doclinks.js';
16+
17+
// start the Stimulus application
18+
import './bootstrap';

assets/bootstrap.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { startStimulusApp } from '@symfony/stimulus-bridge';
2+
3+
// Registers Stimulus controllers from controllers.json and in the controllers/ directory
4+
export const app = startStimulusApp(require.context(
5+
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
6+
true,
7+
/\.(j|t)sx?$/
8+
));
9+
10+
// register any custom, 3rd party controllers here
11+
// app.register('some_controller_name', SomeImportedController);

assets/controllers.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"controllers": [],
3+
"entrypoints": []
4+
}

assets/controllers/.gitignore

Whitespace-only changes.
File renamed without changes.

assets/js/search.js renamed to assets/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import './jquery.instantSearch.js';
1+
import './js/jquery.instantSearch.js';
22

33
$(function() {
44
$('.search-field')

0 commit comments

Comments
 (0)