Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpFoundation] Fix invalid ID not regenerated with native PHP file sessions#47130

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:4.4fromunknown repositoryAug 1, 2022

Conversation

@ghost
Copy link

@ghostghost commentedJul 30, 2022
edited by ghost
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#46993,#47126
LicenseMIT

Inside theSessionHandlerProxy class, the code defines$this->saveHandlerName to\ini_get('session.save_handler') when$handler is an instance of\SessionHandler.

$this->wrapper =$handlerinstanceof \SessionHandler;
$this->saveHandlerName =$this->wrapper ?\ini_get('session.save_handler') :'user';

But inside theNativeSessionStorage class, the code create an instance ofStrictSessionHandler that doesn't inherit from\SessionHandler and is passed to theSessionHandlerProxy constructor.

}elseif (!$saveHandlerinstanceof AbstractProxy) {
$saveHandler =newSessionHandlerProxy(newStrictSessionHandler(new \SessionHandler()));
}

Therefore, we could create aisWrapper() method inside theStrictSessionHandler class to check if the wrapped handler is an internal PHP session handler (\SessionHandler), just likeAbstractProxy::isWrapper().

That's the only solution I have in mind right now.

jevrard reacted with thumbs up emoji
Copy link
Member

@derrabusderrabus left a comment

Choose a reason for hiding this comment

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

Thank you for your PR. Would it be possible to add a test that reproduces the bug you're attempting to fix? I'd like to make sure we don't reintroduce it in the future.

@ghost
Copy link
Author

Thank you for your PR. Would it be possible to add a test that reproduces the bug you're attempting to fix? I'd like to make sure we don't reintroduce it in the future.

@derrabus Unit test done here:657f020

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

LGTM, here are some final notes

Copy link
Author

@ghostghost left a comment
edited by ghost
Loading

Choose a reason for hiding this comment

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

Maybe we should use a more intuitive name for the method? LikeisInternalWrapper,wrapsInternalHandler,hasInternalHandler. What do you think@nicolas-grekas? In my opinion, this makes the method more understandable.

    /**     * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.     *     * @internal     */-   public function isWrapper(): bool+   public function isInternalWrapper(): bool    {        return $this->handler instanceof \SessionHandler;    }
    /**     * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.     *     * @internal     */-   public function isWrapper(): bool+   public function wrapsInternalHandler(): bool    {        return $this->handler instanceof \SessionHandler;    }
    /**     * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.     *     * @internal     */-   public function isWrapper(): bool+   public function hasInternalHandler(): bool    {        return $this->handler instanceof \SessionHandler;    }

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

I'm fine with isWrapper: this is what AbstractProxy uses already for the same thing

@nicolas-grekas
Copy link
Member

Thank you@brokensourcecode.

@nicolas-grekasnicolas-grekas merged commit6c0f7da intosymfony:4.4Aug 1, 2022
This was referencedAug 26, 2022
@fabpotfabpot mentioned this pull requestSep 30, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

3 participants

@nicolas-grekas@derrabus@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp