silverstripe-framework/src/Control
Ingo Schommer 76ac8465de
BUG Lazy session state (fixes #8267)
Fixes regression from 3.x, where sessions where lazy started as required:
Either because an existing session identifier was sent through with the request,
or because new session data needed to be persisted as part of the request execution.

Without this lazy starting, *every* request will get a session,
which makes all those responses uncacheable by HTTP layers.

Note that 4.x also changed the $data vs. $changedData payloads:
In 3.x, they both contained key/value pairs.
In 4.x, $data contains key/value, while $changedData contains key/boolean to declare isChanged.
While this reduces duplication in the class, it also surfaced a bug which was latent in 3.x:
When an existing session is lazily resumed via start(), $data is set back to an empty array.
In 3.x, any changed data before this point was *also* retained in $changedData,
ensuring it gets merged into existing $_SESSION data.
In 4.x, this clears out data - hence the need for a more complex merge logic.

Since isset($this->data) is no longer an accurate indicator of a started session,
we introduce a separate $this->started flag.

Note that I've chosen not to make lazy an opt-in (e.g. via start($request, $lazy=false)).
We already have a distinction between lazy starting via init(), and force starting via start().
2018-07-23 14:09:42 +01:00
..
Email FIX Make sure plain parts are rendered when re-rendering emails 2017-11-08 15:32:51 +00:00
Middleware State default should be state enabled (no-cache is an enabled state) 2018-07-23 14:07:10 +01:00
RSS Improve handling of deprecated apis 2018-06-14 13:01:27 +12:00
CliController.php API Remove Object class 2017-05-23 13:50:35 +12:00
CLIRequestBuilder.php API Refactor bootstrap, request handling 2017-06-22 22:50:45 +12:00
ContentNegotiator.php Reset test state for modified config options 2017-09-28 17:24:32 +13:00
Controller.php WIP of cache middlware 2018-06-13 11:33:45 +12:00
Cookie_Backend.php PSR2: Whitespace-only changes 2016-11-29 12:31:16 +13:00
Cookie.php PSR2: Whitespace-only changes 2016-11-29 12:31:16 +13:00
CookieJar.php API Upgrade code to use updated config 2017-02-27 16:54:01 +13:00
Director.php WIP of cache middlware 2018-06-13 11:33:45 +12:00
HasRequestHandler.php API Refactor Form request handling into FormRequestHandler 2017-03-10 15:04:33 +13:00
HTTP.php Improve handling of deprecated apis 2018-06-14 13:01:27 +12:00
HTTPApplication.php Fix enable ?flush rather than just ?flush=1 2017-06-29 16:13:38 +12:00
HTTPRequest.php Remove "url" query param reliance, use index.php 2017-10-09 17:21:43 +13:00
HTTPRequestBuilder.php Merge branch '4.0' into 4 2018-01-12 14:40:33 +00:00
HTTPResponse_Exception.php PSR2: Whitespace-only changes 2016-11-29 12:31:16 +13:00
HTTPResponse.php Adjust HTTPResponse::getVersion() to match PSR-7 Method signature 2018-06-14 11:04:07 +12:00
HTTPStreamResponse.php API Add streamable response object 2017-05-23 16:32:29 +12:00
IPUtils.php PSR2: Whitespace-only changes 2016-11-29 12:31:16 +13:00
NestedController.php PSR2: Whitespace-only changes 2016-11-29 12:31:16 +13:00
NullHTTPRequest.php PSR2: Whitespace-only changes 2016-11-29 12:31:16 +13:00
PjaxResponseNegotiator.php PSR2: Whitespace-only changes 2016-11-29 12:31:16 +13:00
RequestFilter.php API Stronger Injector service unregistration 2017-06-27 13:32:39 +12:00
RequestHandler.php Refactor redirect cache busting into middleware 2018-06-14 14:11:31 +12:00
RequestProcessor.php Fixing string concat CS issues 2018-01-16 18:39:30 +00:00
Session.php BUG Lazy session state (fixes #8267) 2018-07-23 14:09:42 +01:00
SimpleResourceURLGenerator.php Merge remote-tracking branch 'origin/4.0' into 4 2018-01-25 12:53:15 +13:00