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

Debug bar breaks Xdebug session when redirect occurs #216

Closed
richard-ejem opened this issue Aug 9, 2016 · 10 comments
Closed

Debug bar breaks Xdebug session when redirect occurs #216

richard-ejem opened this issue Aug 9, 2016 · 10 comments

Comments

@richard-ejem
Copy link

@richard-ejem richard-ejem commented Aug 9, 2016

Scenario:

I've proposed a simple solution printing at least console warning to confused developers like me, who would be investigating for hours why XDEBUG stops after first request, will pull request it in a second :)

@richard-ejem

This comment has been minimized.

Copy link
Author

@richard-ejem richard-ejem commented Aug 9, 2016

Thanks to @JanTvrdik for commenting original pull request, I just found even simpler way to detect and fixed the pull request with a single simple commit :)

@dg dg closed this in 6a24bb6 Aug 9, 2016
@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Aug 9, 2016

What about this 6a24bb6?

@richard-ejem

This comment has been minimized.

Copy link
Author

@richard-ejem richard-ejem commented Aug 9, 2016

@dg unfortunatelly not helping, tested on my project :( I will provide some minimal case to reproduce the problem soon

@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Aug 9, 2016

It closes XDEBUG session, but it should close it only once.

@richard-ejem

This comment has been minimized.

Copy link
Author

@richard-ejem richard-ejem commented Aug 9, 2016

Take a look at this MWE: https://github.com/richard-ejem/tracytest
try debugging it in browser, debugger stops working after removing the XDEBUG_SESSION_START argument from URL.

@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Aug 9, 2016

I see, dispatchContent() is not loaded…

dg added a commit that referenced this issue Aug 9, 2016
This reverts commit e98158d.
@richard-ejem

This comment has been minimized.

Copy link
Author

@richard-ejem richard-ejem commented Aug 10, 2016

ok so maybe please re-open the issue?
My suggested fix was just to notify users about the problem, as any redirect before Debugger::enable() when XDEBUG_SESSION_STOP is passed will cause this problem.
Just checked sources of Xdebug, there seems to be no way to stop Xdebug for a single request without destroying the cookie.
Other solution would be to create pull request for Xdebug to add something like XDEBUG_SKIP=1 which would disable Xdebug just for the single request, but it will take long to be merged and downloaded by most users.

Sorry, just noticed that the revert commit fixed the issue.

@richard-ejem

This comment has been minimized.

Copy link
Author

@richard-ejem richard-ejem commented Aug 10, 2016

But there is still one edge case where it can cause problems, see current https://github.com/richard-ejem/tracytest .
In short:

  • I do a state-changing action on some URL (add stuff to cart)
  • it happens before Debugger::enable()
  • I forget to redirect after that action

Would be my bad, that I didn't place a redirect on state-changing URL, but I will really wonder why 4 items are added to my cart instead of 1.

This is merely hypothetical, but maybe should still be considered as a debug tool should cause minimum possible side effects.

@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Aug 10, 2016

This tool must be simply called first in script, otherwise it is not used correctly. I really dont know how handle these cases.

@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Aug 10, 2016

I'm thinking that might be a better solution is yours, just write out a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.