Problem/Motivation

Deprecate direct access to the $_SESSION super global by flagging all keys which are not registered as session bags in SessionManager.

After the deprecation period, remove support for the $_SESSION super global from SessionManager.

Steps to reproduce

Proposed resolution

Determine storage keys of all registered bags in SessionManager::save(). Generate one deprecation for any key which is contained in $_SESSION but isn't present in the list of session bag storage keys.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3518527

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

znerol created an issue. See original summary.

znerol’s picture

Status: Active » Needs work
Issue tags: +Needs tests, +Needs change record

Needs tests for the new deprecation. Also needs a CR for sure.

znerol’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests, -Needs change record

Added a legacy test and a CR.

smustgrave’s picture

Looks good!

Left some comments on the MR.

smustgrave’s picture

Status: Needs review » Needs work

andypost made their first commit to this issue’s fork.

andypost’s picture

Applied clean-up and D12, IMO looks RTBC and is not disruptive since D8

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Feedback appears to be addressed.

znerol’s picture

Status: Reviewed & tested by the community » Needs review

In both SessionTestController and LegacySessionController, the method documentation often declared a completely wrong return type:

  * @return string
  *   A notification message.

Since this MR touches a couple of those methods, I fixed them all.


I agree that deprecating direct access to the $_SESSION is not disruptive. However, the next step will be to remove support for custom session keys completely. I.e., SessionManager would stop considering custom keys in $_SESSION when deciding whether to start/save a session automatically.

If contrib and custom code continue to access custom keys, this might or might not work depending on other circumstances (i.e., whether or not some unrelated part of the system is using the session as well). But problems will be hard to diagnose because custom keys are silently ignored when the deprecation and support for custom keys are dropped.

That was the reason I think a longer deprecation period could be worthwhile in this case.

smustgrave’s picture

Status: Needs review » Postponed

Let’s see what comes from the decision on the policy if some stuff will be pushed to 13

catch’s picture

Status: Postponed » Needs review

That's for 11.3, not 11.2

smustgrave’s picture

Not sure I see the difference if we are still talking about waiting till 13

znerol’s picture

That's for 11.3, not 11.2

Right, then there is no need to delay the deprecation, I guess.

catch’s picture

See #3518671: [policy, no patch] Defer disruptive 11.3 deprecations for removal until 13.0, the Drupal 13 deprecations would start when the 11.3.x branch is open, which is not yet.

andypost’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#3518527: Deprecate custom keys in $_SESSION

I find it good to go and let's discus disruption in #3518527: Deprecate custom keys in $_SESSION

  • alexpott committed 94ccff04 on 11.2.x
    Issue #3518527 by znerol, andypost, smustgrave, catch: Deprecate custom...

  • alexpott committed 5301cfd2 on 11.x
    Issue #3518527 by znerol, andypost, smustgrave, catch: Deprecate custom...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Discussed with @catch we agreed that this can go in the 11.2.x alpha period.

Committed and pushed 5301cfd2371 to 11.x and 94ccff04de2 to 11.2.x. Thanks!

alexpott’s picture

Version: 11.x-dev » 11.2.x-dev

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.