Since the session API has been adjusted it is no longer possible
to access the (now protected) sesData property of the fe_user object.
Using TSFE:fe_user|sesData|foo|bar in a TS condition will trigger
a deprecation log entry.
Instead a cleaner approach is now available:
[globalVar = session:foo|bar =
1234567]
Resolves: #83506
Releases: master
Change-Id: Idbb079334186eac1dfe062a71a601e556a9bd247
Reviewed-on: https://review.typo3.org/55310
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
--- /dev/null
+
+.. include:: ../../Includes.txt
+
+===============================================================================
+Deprecation: #83506 - Deprecated usage of TSFE:fe_user|sesData in TS conditions
+===============================================================================
+
+See :issue:`83506`
+
+Description
+===========
+
+Since the session API has been adjusted it is no longer possible
+to access the (now protected) sesData property of the fe_user object.
+
+
+Impact
+======
+
+Using :typoscript:`[globalVar = TSFE:fe_user|sesData|foo|bar = 1234567]` will trigger a deprecation log entry.
+
+
+Affected Installations
+======================
+
+Any installation using the old value TSFE:fe_user|sesData in a TypoScript condition.
+
+
+Migration
+=========
+
+Use :typoscript:`[globalVar = session:foo|bar = 1234567]` instead.
+
+.. index:: Frontend, TypoScript, NotScanned
--- /dev/null
+.. include:: ../../Includes.txt
+
+========================================================
+Feature: #83506 - Retrieve session data in TS conditions
+========================================================
+
+See :issue:`83506`
+
+Description
+===========
+
+As the session API has been modified, it is no longer possible to access
+session data in TypoScript conditions by using the formerly public
+property ``sesData`` of the frontend user object.
+
+So now there is a more direct way using the keyword ``session``
+with the same function:
+
+.. code-block:: typoscript
+
+ [globalVar = session:foo|bar = 1234567]
+
+.. index:: Frontend, TypoScript
}
/**
- * Returns GP / ENV / TSFE vars
+ * Returns GP / ENV / TSFE / session vars
*
* @example GP:L
* @example TSFE:fe_user|sesData|foo|bar
switch ((string)trim($vars[0])) {
case 'TSFE':
if (strpos($vars[1], 'fe_user|sesData|') === 0) {
+ trigger_error(
+ 'Condition on TSFE|fe_user|sesData is deprecated and will be removed in TYPO3 CMS 10',
+ E_USER_DEPRECATED
+ );
$val = $this->getSessionVariable(substr($vars[1], 16));
} else {
$val = $this->getGlobal('TSFE|' . $vars[1]);
}
break;
+ case 'session':
+ $val = $this->getSessionVariable($vars[1]);
+ break;
default:
}
}
$GLOBALS['TSFE']->testSimpleObject = new \stdClass();
$GLOBALS['TSFE']->testSimpleObject->testSimpleVariable = 'testValue';
+ $this->assertTrue($this->matchCondition->match('[globalString = TSFE:id = 1234567]'));
+ $this->assertTrue($this->matchCondition->match('[globalString = TSFE:testSimpleObject|testSimpleVariable = testValue]'));
+ }
+
+ /**
+ * Tests whether the generic fetching of variables works with the namespace 'session'.
+ *
+ * @test
+ */
+ public function genericGetVariablesSucceedsWithNamespaceSession()
+ {
$prophecy = $this->prophesize(FrontendUserAuthentication::class);
$prophecy->getSessionData(Argument::exact('foo'))->willReturn(['bar' => 1234567]);
$GLOBALS['TSFE']->fe_user = $prophecy->reveal();
- $this->assertTrue($this->matchCondition->match('[globalString = TSFE:id = 1234567]'));
- $this->assertTrue($this->matchCondition->match('[globalString = TSFE:testSimpleObject|testSimpleVariable = testValue]'));
- $this->assertTrue($this->matchCondition->match('[globalString = TSFE:fe_user|sesData|foo|bar = 1234567]'));
+ $this->assertTrue($this->matchCondition->match('[globalString = session:foo|bar = 1234567]'));
}
/**