The Request should be marked as synthetic in the DIC. It's not possible for reasons explained below, but should be.
drupal_session_initialize() function and all other related session functions need access to the Request object. Unfortunately, the session handling is managed before the Request is available. So, when the session calls Drupal::request(), and because the synthetic setting is not set, Symfony is creating an instance of the Request class. This object is created via the constructor, and as such is totally wrong and not based on the real current Request.
The synthetic setting has been added and commented with a @TODO so that we can remember to uncomment it at some point and before the final release at the latest.
In the meantime, the best way to get the real Request object early on is to tweak the Request setting by forcing the Symfony DIC to actually use the
createFromGlobals() method when it creates the Request. This solution is temporary and must be removed whenever the synthetic setting is set to true (the @TODO mentioned that as well).
PASSED: [[SimpleTest]]: [MySQL] 59,049 pass(es).
[ View ]
PASSED: [[SimpleTest]]: [MySQL] 57,933 pass(es).
[ View ]