Skip to content

Different objects can be of the same instance when coming from the Cache #38440

@Kocal

Description

@Kocal

Symfony version(s) affected: 4.4.15 and more

Description
I've chatted with @nicolas-grekas on Slack about a possible issue with the DefaultMarshaller when using igbinary and the Symfony Cache.
I've tried to create the smallest possible reproducer (a new test in DefaultMarshallerTest or in AdapterTestCase) but it wasn't possible. The reproducer use the Symfony Cache (+ Marshaller) and Mailer components.

How to reproduce
Please see https://github.com/Kocal/symfony-marshaller-or-cache-issue, everything is explained in the README.

Comment/uncomment the var_dump($item) and you will see the last var_dump() outputs will change.

Possible Solution
To fix this issue in my app, I had to disable the usage of igbinary with the following service configuration:

cache.default_marshaller:
    class: Symfony\Component\Cache\Marshaller\DefaultMarshaller
    arguments:
        $useIgbinarySerialize: false

Additional context
I'm using PHP 7.4.10 with igbinary 3.1.5.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions