Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is in the JsonSerializationVisitor.php, NotAcceptableException catched and not throw further. #1438

Open
baloraki opened this issue Nov 9, 2022 · 3 comments

Comments

@baloraki
Copy link

baloraki commented Nov 9, 2022

| 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.

@scyzoryck
Copy link
Collaborator

Hello! Could you provide some more details, please?
It looks like the mentioned example should be covered by BaseSerializationTest::testCircularReference().

@baloraki
Copy link
Author

baloraki commented Nov 10, 2022

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.
image

My question is why this is so and what I could do to get out of potential endless loops.

@scyzoryck
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants