Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
77e4ae8 tod007469Comparenicolas-grekas approved these changesMar 12, 2018
fabpot approved these changesMar 13, 2018
Member
fabpot commentedMar 13, 2018
Thank you@tuxone. |
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 MemcachedSessionHandlerAuthor
tuxone commentedMar 13, 2018
Thanks for merging@fabpot |
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Conditions: Symfony 3.4, PHP7 and sessions handled over memcache.
Apparently
memcached::touch()returnsfalseon a subsequent call with the same parameters. SinceupdateTimestampis used inAbstractSessionHandler::write()the result is that
write()will returnfalseonany subsequent request within the same second causing the following error:Can be reproduced on
symfony/skeleton:3.4adding the following code topublic/index.phpand performing two consecutive requests: