Skip to content

Conversation

@alexandre-daubois
Copy link
Member

@alexandre-daubois alexandre-daubois commented Sep 30, 2024

Q A
Branch? 5.4
Bug fix? no
New feature? no
Deprecations? no
Issues -
License MIT

LegacyRoleTest triggers the following error:

Legacy deprecation triggered by Symfony\Component\Security\Core\Tests\Role\LegacyRoleTest::testPayloadFromV4CanBeUnserialized:
Creation of dynamic property Symfony\Component\Security\Core\Role\Role::$Symfony\Component\Security\Core\Role\Role is deprecated

{
public function testPayloadFromV4CanBeUnserialized()
{
$serialized = 'C:74:"Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken":236:{a:3:{i:0;N;i:1;s:4:"main";i:2;a:5:{i:0;s:2:"sf";i:1;b:1;i:2;a:1:{i:0;O:41:"Symfony\Component\Security\Core\Role\Role":1:{s:47:"Symfony\Component\Security\Core\Role\Role'."\0".'role'."\0".'";s:9:"ROLE_USER";}}i:3;a:0:{}i:4;a:1:{i:0;s:9:"ROLE_USER";}}}}';
Copy link
Member

@nicolas-grekas nicolas-grekas Oct 1, 2024

Choose a reason for hiding this comment

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

I'd rather keep the files but fix the serialized payload, which is incorrect (branch 5.4 I guess):

-"Symfony\Component\Security\Core\Role\Role'."\0".'role'."\0".'"
+"'."\0".'Symfony\Component\Security\Core\Role\Role'."\0".'role"

Copy link
Member Author

Choose a reason for hiding this comment

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

Works for me, the deprecation notice is gone. Thanks!

@alexandre-daubois alexandre-daubois changed the base branch from 7.2 to 5.4 October 1, 2024 11:25
@alexandre-daubois alexandre-daubois changed the title [Security] Remove legacy internal classes [Security] Fix serialized object representation in tests Oct 1, 2024
@nicolas-grekas nicolas-grekas modified the milestones: 7.2, 5.4 Oct 1, 2024
@nicolas-grekas
Copy link
Member

Thank you @alexandre-daubois.

@nicolas-grekas nicolas-grekas merged commit 18ad416 into symfony:5.4 Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants