Skip to content

[Messenger] Fix cloned TraceableStack not unstacking the stack independently #51675

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

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

krciga22
Copy link
Contributor

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #51564
License MIT
Doc PR symfony/symfony-docs#...

Fixed a bug with cloned TraceableStack not unstacking the stack independently from the original due to the __clone() method not yet being implemented. Clones of StackMiddleware currently unstack the stack independently, but not TraceableStack.

public function testClonedTraceableStackUnstacksIndependently()
{
// import TraceableStack
class_exists(TraceableMiddleware::class);
Copy link
Member

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nicolas-grekas, I added this test method to test if a clone can be unstacked independently. I noticed that the existing method testHandle() in the same file does test TraceableStack unstacking via the use of TraceableMiddleware, but it doesn't test if a cloned version will unstack the stack independently, so I was thinking their could be a new test for that as well?

Copy link
Member

Choose a reason for hiding this comment

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

I meant the class_exists check, why is it needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, without it I get the following error:
Error: Class 'Symfony\Component\Messenger\Middleware\TraceableStack' not found

To fix the error, I tried to import TraceableStack at the top of the test file, but I can't get it to work because it's located within TraceableMiddleware.php instead of within its own file.

@nicolas-grekas
Copy link
Member

Thank you @krciga22.

@nicolas-grekas nicolas-grekas merged commit aa56d07 into symfony:5.4 Sep 20, 2023
This was referenced Sep 30, 2023
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.

5 participants