A
A
Alexey Anisimov2017-05-19 16:12:38
symfony
Alexey Anisimov, 2017-05-19 16:12:38

Symfony and Redis why is the persisted object not equal to the one retrieved from the cache?

Good afternoon.
The project is written in symfony. This is an Api, jms/serializer-bundle
is used for serialization. I use the Symfony/Cache component to work with Redis (RedisAdapter).
I save an array of objects. After extracting and returning to response I get an error

{"code":500,"message":"Warning: Invalid argument supplied for foreach()"}

This is not the case for all objects.
When comparing the serialized cache and an array of objects, I get true.
The nesting of objects is large.
I don't understand where this foreach comes from. Possibly in the serializer.
Any ideas why that is?
Perhaps someone already had a similar bug.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shirshov Alexander, 2017-05-19
@Keanor

Turn on the warning interceptor before serialization and catch these errors. Where you catch them, you will have enough information to understand what happened. And you won’t make a senseless save.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question