serializer
serializer copied to clipboard
Why is in the JsonSerializationVisitor.php, NotAcceptableException catched and not throw further.
| Question
Steps required to reproduce the problem
Serialize an object with some circular reference
Expected Result
Error CircularReferenceDetectedException from SerializationGraphNavigator::accept should not catched in JsonSerializationVisitor::visitProperty, to avoid endless loops.
Actual Result
The error will catched in JsonSerializationVisitor::visitProperty, which ends in a endles loop, when in the data circular references exist.
Hello! Could you provide some more details, please?
It looks like the mentioned example should be covered by BaseSerializationTest::testCircularReference()
.
Hello, thanks for the response. The problem is that when the accept, in a visit( e.g. visitProperty), throws a CircularReferenceDetectedException, it will be caught with NotAcceptableException and it continues.
My expected outcome is simply that the error is not caught, as in my case it results in an infinite loop.
My question is why this is so and what I could do to get out of potential endless loops.
Is it possible to reproduce your use case with some unit test or code snippet? It looks like a bug - as in most cases it should skip the property that contains circular reference what would break the loop.