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

[Fix][3.4][HttpFoundation] Fix the updating of timestamp in the MemcachedSessionHandler#26443

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
fabpot merged 1 commit intosymfony:3.4fromtuxone:fix/memcache-timestamp-updating
Mar 13, 2018

Conversation

@tuxone
Copy link

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
LicenseMIT

Conditions: Symfony 3.4, PHP7 and sessions handled over memcache.

Apparentlymemcached::touch() returnsfalse on a subsequent call with the same parameters. SinceupdateTimestamp is used inAbstractSessionHandler::write()

public function write($sessionId, $data)    {        if (\PHP_VERSION_ID < 70000 && $this->prefetchData) {            $readData = $this->prefetchData;            $this->prefetchData = null;            if ($readData === $data) {                return $this->updateTimestamp($sessionId, $data);            }        }...

the result is thatwrite() will returnfalse onany subsequent request within the same second causing the following error:

HP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ContextErrorException: Warning: session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions) in Unknown:0Stack trace:#0 [internal function]: Symfony\Component\Debug\ErrorHandler->handleError(2, 'session_write_c...', 'Unknown', 0, NULL)#1 [internal function]: session_write_close()#2 {main}  thrown in Unknown on line 0

Can be reproduced onsymfony/skeleton:3.4 adding the following code topublic/index.php and performing two consecutive requests:

$session = $kernel->getContainer()->get('session');$session->set("foo", "bar");

@tuxonetuxoneforce-pushed thefix/memcache-timestamp-updating branch from77e4ae8 tod007469CompareMarch 7, 2018 13:52
@nicolas-grekasnicolas-grekas added this to the3.4 milestoneMar 12, 2018
@fabpot
Copy link
Member

Thank you@tuxone.

@fabpotfabpot merged commitd007469 intosymfony:3.4Mar 13, 2018
fabpot added a commit that referenced this pull requestMar 13, 2018
…n the MemcachedSessionHandler (Alessandro Loffredo)This PR was merged into the 3.4 branch.Discussion----------[Fix][3.4][HttpFoundation] Fix the updating of timestamp in the MemcachedSessionHandler| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| License       | MITConditions: Symfony 3.4, PHP7 and sessions handled over memcache.Apparently `memcached::touch()` returns `false` on a subsequent call with the same parameters. Since `updateTimestamp` is used in `AbstractSessionHandler::write()````public function write($sessionId, $data)    {        if (\PHP_VERSION_ID < 70000 && $this->prefetchData) {            $readData = $this->prefetchData;            $this->prefetchData = null;            if ($readData === $data) {                return $this->updateTimestamp($sessionId, $data);            }        }...```the result is that `write()` will return `false` on **any subsequent request within the same second** causing the following error:```HP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ContextErrorException: Warning: session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions) in Unknown:0Stack trace:#0 [internal function]: Symfony\Component\Debug\ErrorHandler->handleError(2, 'session_write_c...', 'Unknown', 0, NULL)#1 [internal function]: session_write_close()#2 {main}  thrown in Unknown on line 0```Can be reproduced on `symfony/skeleton:3.4` adding the following code to `public/index.php` and performing two consecutive requests:```$session = $kernel->getContainer()->get('session');$session->set("foo", "bar");```Commits-------d007469 fix the updating of timestamp in the MemcachedSessionHandler
@tuxone
Copy link
Author

Thanks for merging@fabpot

@tuxonetuxone deleted the fix/memcache-timestamp-updating branchMarch 13, 2018 22:36
This was referencedApr 3, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

4 participants

@tuxone@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp