Skip to content

Profiler respect stateless attribute #50218

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
May 5, 2023

Conversation

alamirault
Copy link
Contributor

@alamirault alamirault commented May 2, 2023

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

Now that #50198 forward _stateless attribute in fragments, this PR check this attribute and make profiler stateless when is required.

I don't know which tests I have to add because session is not checked. (I checked on reproducer and it's ok)

@carsonbot carsonbot added this to the 5.4 milestone May 2, 2023
@alamirault alamirault changed the title [WebPorfilerBundle] Profiler respect stateless attribute [WebProfilerBundle] Profiler respect stateless attribute May 2, 2023
@MatTheCat
Copy link
Contributor

#50198 was a new feature so it is only available on the 6.3 branch 😅

I looked for a way to test this and it seems we have to update WebProfilerBundleKernel to allow configuring the debug mode.

Copy link
Member

@stof stof left a comment

Choose a reason for hiding this comment

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

This should be done in 6.3 IMO as it relies on the previous PR that is merged in 6.3

@alamirault alamirault force-pushed the hotfix/50037-stateless-profiler branch from a763930 to 7820776 Compare May 3, 2023 17:59
@alamirault alamirault changed the base branch from 5.4 to 6.3 May 3, 2023 17:59
@alamirault alamirault requested a review from stof May 3, 2023 18:00
@carsonbot carsonbot changed the title [WebProfilerBundle] Profiler respect stateless attribute Profiler respect stateless attribute May 4, 2023
@fabpot fabpot modified the milestones: 5.4, 6.3 May 5, 2023
@fabpot
Copy link
Member

fabpot commented May 5, 2023

Thank you @alamirault.

$session = $request->hasSession() ? $request->getSession() : null;

$session = null;
if ($request->attributes->getBoolean('_stateless') && $request->hasSession()) {
Copy link
Contributor

@themasch themasch Jul 8, 2024

Choose a reason for hiding this comment

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

I know I am late, but I thought posting it here was less interruptive then creating a new issue or discussion for this question:

The PR touches 3 placed where it gets the session and adds checks for the _stateless request attribute.
Two checks check for !stateless && hasSession while one of them (in searchBarAction) checks for stateless && hasSession (without the !).

I found this while debugging for what starts Session was used while the request was declared stateless. when calling the profiler. As far as I can tell, the only place using the session there is the this spot.

This line looks incorret to me, I think its missing the ! in front. But since I'm probably wrong (since this is like this for a year now, with no one noticing) I'd like to learn why I am wrong!

Copy link
Contributor

@MatTheCat MatTheCat Jul 8, 2024

Choose a reason for hiding this comment

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

Just tested and you’re not wrong. Maybe you really are the first to notice 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand the implications of this correct, then that means that for users that have stateless: false, restoring the search bar state from session should not work, as it would not use the session in those cases. It would only use the session if stateless: true (e.g. when there should be no session). Correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

for users that have stateless: false, restoring the search bar state from session should not work

Yes, that also includes users who did not set _stateless. Are you up for a PR? Looks like you already know the fix!

Copy link
Contributor

Choose a reason for hiding this comment

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

I can give it a try: #57679
Hope thats correct so far.

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.

[WebProfilerBundle] Profiler is not stateless
6 participants