Skip to content

Why is SessionManager used instead of its Interface? #19274

Closed
@dyuk1987

Description

@dyuk1987

Summary (*)

I was trying to fix the issue mentioned in #12362, by injecting an updated version of SessionManager to replace the original Magento\Framework\Session\SessionManager, on a Magento 2.2.5. After a while, I managed to find a few exceptions being thrown around by some of the third-party modules I have previously installed. The main problem here is that some of the classes in those modules have directly included "Magento\Framework\Session\SessionManager" in the constructor (instead of Magento\Framework\Session\SessionManagerInterface). I was worried if the replacement would cause similar problems elsewhere in the system, so I have done a few greps to look for classes having the SessionManager directly injected into their constructors, and I managed to find a few of them in the core codepool, namely Paypal\Controller\Transparent\RequestSecureToken and Magento\Framework\View\Context.
I am not quite sure why it is so, but it seems to me the interface should be used instead.

Examples (*)

I don't really have an example here.

Proposed solution

To change Magento\Framework\Session\SessionManager to Magento\Framework\Session\SessionManagerInterface

In

  1. Magento/Authorizenet/Model/Directpost/Session.php
  2. Magento/Customer/CustomerData/Plugin/SessionChecker.php
  3. Magento/Paypal/Controller/Transparent/RequestSecureToken.php
  4. lib/internal/Magento/Framework/View/Context.php

Metadata

Metadata

Assignees

Labels

Component: Framework/SessionFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions