diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-71917-DeprecateTheArgumentHscForGetLLGetLLLAndSL.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-71917-DeprecateTheArgumentHscForGetLLGetLLLAndSL.rst new file mode 100644 index 0000000000000000000000000000000000000000..29d87f4c546a3b9e9df77dd53f83b80c3ca11c58 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-71917-DeprecateTheArgumentHscForGetLLGetLLLAndSL.rst @@ -0,0 +1,30 @@ +=========================================================================== +Deprecation: #71917 - Deprecate the argument 'hsc' for getLL, getLLL and sL +=========================================================================== + +Description +=========== + +The parameter :php:`$hsc` within the following methods of :php:`TYPO3\CMS\Lang\LanguageService` has been marked as deprecated: + +* :php:`getLL()` +* :php:`getLLL()` +* :php:`sL()` + + +Impact +====== + +Directly or indirectly using any of the methods :php:`getLL()`, :php:`getLLL()` or :php:`sL()` with the parameter :php:`$hsc` will trigger a deprecation log entry. + + +Affected Installations +====================== + +Any installation with a third-party extension calling one of the methods in its PHP code. + + +Migration +========= + +If the return value of these methods is output in HTML context use :php:`htmlspecialchars` directly to properly escape the content. \ No newline at end of file diff --git a/typo3/sysext/lang/Classes/LanguageService.php b/typo3/sysext/lang/Classes/LanguageService.php index c32fc5dcaf68659100000b35fd6aeb655e2c01bb..3c71765f2b46e64c1834a298fcd39bcb6d984fd5 100755 --- a/typo3/sysext/lang/Classes/LanguageService.php +++ b/typo3/sysext/lang/Classes/LanguageService.php @@ -214,7 +214,7 @@ class LanguageService * Mostly used from modules with only one LOCAL_LANG file loaded into the global space. * * @param string $index Label key - * @param bool $hsc If set, the return value is htmlspecialchar'ed + * @param bool $hsc DEPRECATED If set, the return value is htmlspecialchar'ed * @return string */ public function getLL($index, $hsc = false) @@ -227,11 +227,18 @@ class LanguageService * * @param string $index Label key * @param array $localLanguage $LOCAL_LANG array to get label key from - * @param bool $hsc If set, the return value is htmlspecialchar'ed + * @param bool $hsc DEPRECATED If set, the return value is htmlspecialchar'ed * @return string */ public function getLLL($index, $localLanguage, $hsc = false) { + // @deprecated since TYPO3 v8, will be removed in TYPO3 v9 + if ($hsc) { + GeneralUtility::deprecationLog( + 'Calling getLLL() with argument \'hsc\' has been deprecated.' + ); + } + // Get Local Language. Special handling for all extensions that // read PHP LL files and pass arrays here directly. if (isset($localLanguage[$this->lang][$index])) { @@ -259,11 +266,18 @@ class LanguageService * Refer to 'Inside TYPO3' for more details * * @param string $input Label key/reference - * @param bool $hsc If set, the return value is htmlspecialchar'ed + * @param bool $hsc DEPRECATED If set, the return value is htmlspecialchar'ed * @return string */ public function sL($input, $hsc = false) { + // @deprecated since TYPO3 v8, will be removed in TYPO3 v9 + if ($hsc) { + GeneralUtility::deprecationLog( + 'Calling sL() with argument \'hsc\' has been deprecated.' + ); + } + $identifier = $input . '_' . (int)$hsc . '_' . (int)$this->debugKey; if (isset($this->LL_labels_cache[$this->lang][$identifier])) { return $this->LL_labels_cache[$this->lang][$identifier];