Bug #46703

Session has side effects in functional tests

Added by Robert Lemke over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
Session
Start date:
2013-03-27
Due date:
% Done:

100%

PHP Version:
5.4
Has patch:
No
Complexity:
hard

Description

Consider the following code in a functional test:

    $response = $this->browser->request('http://localhost/test/session');
    $this->assertTrue($response->hasCookie('TYPO3_Flow_Session'));

    $response = $this->browser->request('http://localhost/test/session');
    $this->assertTrue($response->hasCookie('TYPO3_Flow_Session'));

The first assertion will succeed because the new session sends a session cookie in its response.
The second assertion will fail because the session object seems to be reused and not fully cleared before it is used again in the second browser request.


Related issues

Related to TYPO3.Flow - Bug #46428: Session is started on every request Resolved 2013-03-19

Associated revisions

Revision 2fdafb69 (diff)
Added by Robert Lemke over 6 years ago

[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

Revision 8f6917b6 (diff)
Added by Robert Lemke over 6 years ago

[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 Gerrit Code Review over 6 years ago

  • Status changed from Accepted 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

#2 Updated by Gerrit Code Review over 6 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/19338

#3 Updated by Anonymous over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#4 Updated by Gerrit Code Review over 6 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

#5 Updated by Gerrit Code Review over 6 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

#6 Updated by Anonymous over 6 years ago

  • Status changed from Under Review to Resolved

Also available in: Atom PDF