Repository navigation
Conversation
|
Thanks @banghamid for the clear diagnosis and fix! The core change is solid and follows the pattern established in A few suggestions regarding the tests before merging:
|
|
Thanks @gr8man for checking this! Good points on both test cases. Just pushed an update:
Also noticed point 3 got cut off right after the |
|
You need to fix the tests. composer cs-fix and rector |
464627c to
ed78e22
Compare
|
I've updated the PR with the suggested changes (close() simplified, MemcachedHandlerTest cleaned up with unique session IDs in tearDown(), plus testRegenerateSessionIdWriteWithoutClose()). All static analysis, Rector, and PHP CS Fixer checks are green on ed78e22. The only failure is phpcpd / Code Copy-Paste Detection with exit code 127 — it looks like an upstream CI issue because https://phar.phpunit.de/phpcpd-6.0.3.phar is currently returning 404/522 during setup-php, so phpcpd never gets installed on the runner. |
|
Rerun test : |
|
Re-triggered CI as suggested @gr8man — all 56 checks (including |
Description
In
MemcachedHandler:close()previously called$this->memcached->delete($this->lockKey)directly instead of$this->releaseLock(), leaving$this->lockKeynon-null and$this->lockset totrueafter the lock key was deleted from Memcached. When the sameMemcachedHandlerinstance was reused (e.g.,session_write_close()followed bysession_start(), or across session ID regeneration), the subsequentread()calledlockSession(), sawisset($this->lockKey) === true, and called$this->memcached->replace($this->lockKey, ...)on the already-deleted key—which returnedfalseand causedread()to fail and return''.lockSession(string $sessionID)only checkedif (isset($this->lockKey))rather than verifying that$this->lockKeymatches the lock key for$sessionID(unlikeRedisHandler::lockSession()).This PR updates
MemcachedHandler::close()to release the lock via$this->releaseLock()and updatesMemcachedHandler::lockSession()to check$this->lockKey === $lockKeybefore refreshing the existing lock TTL.Checklist: