Bug #44202
$session->start() initializes a new session and does not resume a current one
Status: | Resolved | Start date: | 2012-12-22 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | Robert Lemke | % Done: | 100% |
|
Category: | Session | |||
Target version: | TYPO3 Flow Base Distribution - 2.0 | |||
PHP Version: | Complexity: | |||
Has patch: | No | Affected Flow version: | Flow 2.0.0 beta 1 |
Description
Disclaimer: I did not test anything, but only making assumptions by reading the code. Just close this ticket if I'm mistaken.
When introducing the new session handling in #43376 the "start" method of the session object changed it's notion.
Before "start" initialized a new session or resumed an existing one
public function start() { if ($this->started === FALSE) { $this->startOrResume(); } }
Now the start method clearly initializes a completely new session:
public function start() { if ($this->request === NULL) { $this->initializeHttpAndCookie(); } if ($this->started === FALSE) { $this->sessionIdentifier = Algorithms::generateRandomString(32); $this->storageIdentifier = Algorithms::generateUUID(); ...
This is a severe change in behaviour, which at least breaks the @Flow\Session(autoStart=true) annotation, because the LazyLoadingAspect explicitly calls $this->session->start();
public function initializeSession(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint) { if ($this->session->isStarted() === TRUE) { return; } $objectName = $this->objectManager->getObjectNameByClassName(get_class($joinPoint->getProxy())); $methodName = $joinPoint->getMethodName(); $this->systemLogger->log(sprintf('Session initialization triggered by %s->%s.', $objectName, $methodName), LOG_DEBUG); $this->session->start(); }
These methods will never get a resumed session, but always a fresh one.
P.S.: I cannot select the "Session" category, but only Documentation, Testing and Build Process. Maybe you should check the project permissions.
Related issues
Associated revisions
[BUGFIX] Reduce side effects of sessions used in functional tests
This patch makes sure that once a session has been closed or
destroyed, it will rebuild information determined from the request /
response in case it is started again.
While this scenario (a session is closed and started again during
the same PHP request) is uncommon in real world projects, it may
happen during functional tests. Therefore this is mainly a fix to
reduce side effects in functional tests.
A concrete side effect Flow has without this patch is that session
cookies are set to the HTTP response only when a session was
started the first time.
This patch also adds an explanation about starting / resuming
sessions to the class doc comment.
Change-Id: Ia78851bd3167733114b94255e5ee201ca3197564
Resolves: #46703
Resolves: #44202
Releases: master, 2.0
[BUGFIX] Reduce side effects of sessions used in functional tests
This patch makes sure that once a session has been closed or
destroyed, it will rebuild information determined from the request /
response in case it is started again.
While this scenario (a session is closed and started again during
the same PHP request) is uncommon in real world projects, it may
happen during functional tests. Therefore this is mainly a fix to
reduce side effects in functional tests.
A concrete side effect Flow has without this patch is that session
cookies are set to the HTTP response only when a session was
started the first time.
This patch also adds an explanation about starting / resuming
sessions to the class doc comment.
Change-Id: Ia78851bd3167733114b94255e5ee201ca3197564
Resolves: #46703
Resolves: #44202
Releases: master, 2.0
History
#1 Updated by Karsten Dambekalns over 2 years ago
- Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow
#2 Updated by Karsten Dambekalns over 2 years ago
- Category set to Session
- Status changed from New to Needs Feedback
- Assigned To set to Robert Lemke
- Has patch set to No
Helmut, the categories you were looking for are in the Flow project, not the base distribution… :)
#3 Updated by Robert Lemke over 2 years ago
The session is automatically resumed by the Bootstrap (calling resume()) and if that was successful, calling start() at a later stage will be a noop. I'll add a description of that mechanism to the Script doc comment.
#4 Updated by Gerrit Code Review over 2 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19338
#5 Updated by Gerrit Code Review over 2 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19338
#6 Updated by Anonymous over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 2fdafb69fa403e2bc55c10f9f1d28808dcd0fc6f.
#7 Updated by Gerrit Code Review over 2 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/19594
#8 Updated by Gerrit Code Review over 2 years ago
Patch set 2 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/19594
#9 Updated by Anonymous over 2 years ago
- Status changed from Under Review to Resolved
Applied in changeset 8f6917b64af670e3b0bd4d288b94fde74971ae6c.