Skip to content

Commit 8c3c31d

Browse files
committed
Merge branch '2.3-develop' of https://github.com/magento/magento2ce into PR-13-02-2020
2 parents 561674f + a0cd931 commit 8c3c31d

File tree

18 files changed

+94
-181
lines changed

18 files changed

+94
-181
lines changed

app/code/Magento/Catalog/Model/Template/Filter.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
/**
1616
* Work with catalog(store, website) urls
17-
*
18-
* @package Magento\Catalog\Model\Template
1917
*/
2018
class Filter extends \Magento\Framework\Filter\Template
2119
{
@@ -30,6 +28,7 @@ class Filter extends \Magento\Framework\Filter\Template
3028
* Whether to allow SID in store directive: NO
3129
*
3230
* @var bool
31+
* @deprecated SID query parameter is not used in URLs anymore.
3332
*/
3433
protected $_useSessionInUrl = false;
3534

@@ -81,10 +80,14 @@ public function setUseAbsoluteLinks($flag)
8180
*
8281
* @param bool $flag
8382
* @return $this
83+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
84+
* @deprecated SID query parameter is not used in URLs anymore.
8485
*/
8586
public function setUseSessionInUrl($flag)
8687
{
87-
$this->_useSessionInUrl = $flag;
88+
// phpcs:disable Magento2.Functions.DiscouragedFunction
89+
trigger_error('Session ID is not used as URL parameter anymore.', E_USER_DEPRECATED);
90+
8891
return $this;
8992
}
9093

@@ -126,6 +129,7 @@ public function viewDirective($construction)
126129
*/
127130
public function mediaDirective($construction)
128131
{
132+
// phpcs:disable Magento2.Functions.DiscouragedFunction
129133
$params = $this->getParameters(html_entity_decode($construction[2], ENT_QUOTES));
130134
return $this->_storeManager->getStore()
131135
->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url'];

app/code/Magento/Cms/Model/Template/Filter.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,6 @@
1212
*/
1313
class Filter extends \Magento\Email\Model\Template\Filter
1414
{
15-
/**
16-
* Whether to allow SID in store directive: AUTO
17-
*
18-
* @var bool
19-
*/
20-
protected $_useSessionInUrl;
21-
22-
/**
23-
* Setter whether SID is allowed in store directive
24-
*
25-
* @param bool $flag
26-
* @return $this
27-
*/
28-
public function setUseSessionInUrl($flag)
29-
{
30-
$this->_useSessionInUrl = (bool)$flag;
31-
return $this;
32-
}
33-
3415
/**
3516
* Retrieve media file URL directive
3617
*

app/code/Magento/Email/Model/Template/Filter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class Filter extends \Magento\Framework\Filter\Template
4444
* Whether to allow SID in store directive: NO
4545
*
4646
* @var bool
47+
* @deprecated SID is not being used as query parameter anymore.
4748
*/
4849
protected $_useSessionInUrl = false;
4950

@@ -263,10 +264,14 @@ public function setUseAbsoluteLinks($flag)
263264
*
264265
* @param bool $flag
265266
* @return $this
267+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
268+
* @deprecated SID query parameter is not used in URLs anymore.
266269
*/
267270
public function setUseSessionInUrl($flag)
268271
{
269-
$this->_useSessionInUrl = $flag;
272+
// phpcs:disable Magento2.Functions.DiscouragedFunction
273+
trigger_error('Session ID is not used as URL parameter anymore.', E_USER_DEPRECATED);
274+
270275
return $this;
271276
}
272277

app/code/Magento/Store/Model/StoreSwitcher/CleanTargetUrl.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
/**
1616
* Remove SID, from_store, store from target url.
17+
*
18+
* Used in store-switching process in HTML frontend.
19+
*
20+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1721
*/
1822
class CleanTargetUrl implements StoreSwitcherInterface
1923
{
@@ -22,42 +26,32 @@ class CleanTargetUrl implements StoreSwitcherInterface
2226
*/
2327
private $urlHelper;
2428

25-
/**
26-
* @var \Magento\Framework\Session\Generic
27-
*/
28-
private $session;
29-
30-
/**
31-
* @var \Magento\Framework\Session\SidResolverInterface
32-
*/
33-
private $sidResolver;
34-
3529
/**
3630
* @param UrlHelper $urlHelper
3731
* @param \Magento\Framework\Session\Generic $session
3832
* @param \Magento\Framework\Session\SidResolverInterface $sidResolver
33+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3934
*/
4035
public function __construct(
4136
UrlHelper $urlHelper,
4237
\Magento\Framework\Session\Generic $session,
4338
\Magento\Framework\Session\SidResolverInterface $sidResolver
4439
) {
4540
$this->urlHelper = $urlHelper;
46-
$this->session = $session;
47-
$this->sidResolver = $sidResolver;
4841
}
4942

5043
/**
44+
* Generate target URL to switch stores through other mechanism then via URL params.
45+
*
5146
* @param StoreInterface $fromStore store where we came from
5247
* @param StoreInterface $targetStore store where to go to
5348
* @param string $redirectUrl original url requested for redirect after switching
5449
* @return string redirect url
50+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5551
*/
5652
public function switch(StoreInterface $fromStore, StoreInterface $targetStore, string $redirectUrl): string
5753
{
5854
$targetUrl = $redirectUrl;
59-
$sidName = $this->sidResolver->getSessionIdQueryParam($this->session);
60-
$targetUrl = $this->urlHelper->removeRequestParam($targetUrl, $sidName);
6155
$targetUrl = $this->urlHelper->removeRequestParam($targetUrl, '___from_store');
6256
$targetUrl = $this->urlHelper->removeRequestParam($targetUrl, StoreResolverInterface::PARAM_NAME);
6357

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"colinmollenhour/cache-backend-redis": "1.10.6",
3434
"colinmollenhour/credis": "1.10.0",
3535
"colinmollenhour/php-redis-session-abstract": "~1.4.0",
36-
"composer/composer": "^1.6",
36+
"composer/composer": "^1.9",
3737
"elasticsearch/elasticsearch": "~2.0||~5.1||~6.1",
3838
"guzzlehttp/guzzle": "^6.3.3",
3939
"laminas/laminas-captcha": "^2.7.1",
@@ -320,7 +320,7 @@
320320
"Magento\\Framework\\": "lib/internal/Magento/Framework/",
321321
"Magento\\Setup\\": "setup/src/Magento/Setup/",
322322
"Magento\\": "app/code/Magento/",
323-
"Laminas\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/"
323+
"Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/"
324324
},
325325
"psr-0": {
326326
"": [

composer.lock

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,22 +225,6 @@ public function testSetSessionId()
225225
$this->assertEquals('test', $this->model->getSessionId());
226226
}
227227

228-
/**
229-
* @magentoConfigFixture current_store web/session/use_frontend_sid 1
230-
*/
231-
public function testSetSessionIdFromParam()
232-
{
233-
$this->initializeModel();
234-
$this->appState->expects($this->any())
235-
->method('getAreaCode')
236-
->willReturn(\Magento\Framework\App\Area::AREA_FRONTEND);
237-
$currentId = $this->model->getSessionId();
238-
$this->assertNotEquals('test_id', $this->model->getSessionId());
239-
$this->request->getQuery()->set(SidResolverInterface::SESSION_ID_QUERY_PARAM, 'test-id');
240-
$this->model->setSessionId($this->sidResolver->getSid($this->model));
241-
$this->assertEquals($currentId, $this->model->getSessionId());
242-
}
243-
244228
public function testGetSessionIdForHost()
245229
{
246230
$this->initializeModel();

dev/tests/integration/testsuite/Magento/Framework/UrlTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ protected function setUp()
2323
$this->model = Bootstrap::getObjectManager()->create(\Magento\Framework\Url::class);
2424
}
2525

26-
public function testSetGetUseSession()
27-
{
28-
$this->assertFalse((bool)$this->model->getUseSession());
29-
$this->model->setUseSession(false);
30-
$this->assertFalse($this->model->getUseSession());
31-
}
32-
3326
public function testSetRouteFrontName()
3427
{
3528
$value = 'route';

dev/tests/integration/testsuite/Magento/Store/Model/StoreSwitcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function setUp()
4242
*/
4343
public function testSwitch(): void
4444
{
45-
$redirectUrl = "http://domain.com/?SID=e5h3e086dce3ckkqt9ia7avl27&___store=fixture_second_store";
45+
$redirectUrl = "http://domain.com/?___store=fixture_second_store";
4646
$expectedUrl = "http://domain.com/";
4747
$fromStoreCode = 'test';
4848
/** @var \Magento\Store\Api\StoreRepositoryInterface $storeRepository */

lib/internal/Magento/Framework/Session/SessionManager.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
use Magento\Framework\Session\Config\ConfigInterface;
1111

1212
/**
13-
* Session Manager
13+
* Standard session management.
14+
*
1415
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1516
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1617
*/
@@ -200,9 +201,6 @@ public function start()
200201
session_commit();
201202
session_id($_SESSION['new_session_id']);
202203
}
203-
$sid = $this->sidResolver->getSid($this);
204-
// potential custom logic for session id (ex. switching between hosts)
205-
$this->setSessionId($sid);
206204
session_start();
207205
if (isset($_SESSION['destroyed'])
208206
&& $_SESSION['destroyed'] < time() - $this->sessionConfig->getCookieLifetime()
@@ -211,7 +209,7 @@ public function start()
211209
}
212210

213211
$this->validator->validate($this);
214-
$this->renewCookie($sid);
212+
$this->renewCookie(null);
215213

216214
register_shutdown_function([$this, 'writeClose']);
217215

0 commit comments

Comments
 (0)