File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -494,6 +494,7 @@ private function doRead($sessionId)
494494 $ selectSql = $ this ->getSelectSql ();
495495 $ selectStmt = $ this ->pdo ->prepare ($ selectSql );
496496 $ selectStmt ->bindParam (':id ' , $ sessionId , \PDO ::PARAM_STR );
497+ $ insertStmt = null ;
497498
498499 do {
499500 $ selectStmt ->execute ();
@@ -509,6 +510,11 @@ private function doRead($sessionId)
509510 return is_resource ($ sessionRows [0 ][0 ]) ? stream_get_contents ($ sessionRows [0 ][0 ]) : $ sessionRows [0 ][0 ];
510511 }
511512
513+ if (null !== $ insertStmt ) {
514+ $ this ->rollback ();
515+ throw new \RuntimeException ('Failed to read session: INSERT reported a duplicate id but next SELECT did not return any data. ' );
516+ }
517+
512518 if (self ::LOCK_TRANSACTIONAL === $ this ->lockMode && 'sqlite ' !== $ this ->driver ) {
513519 // Exclusive-reading of non-existent rows does not block, so we need to do an insert to block
514520 // until other connections to the session are committed.
You can’t perform that action at this time.
0 commit comments