From bafb0dd445ec1fb58daa1e0d55f6c7f0568a7c20 Mon Sep 17 00:00:00 2001
From: Jigal van Hemert <jigal.van.hemert@typo3.org>
Date: Fri, 27 Feb 2015 11:11:36 +0100
Subject: [PATCH] [CLEANUP] Deprecate DataHandler property stripslashes_values

The functionality is unnecessary and it's confusing when using
DataHandler that it must be explicitly set to FALSE to handle properly
prepared data. The only place in the core where it was set to TRUE only
handles integer values.

Releases: master
Resolves: #65381
Change-Id: I968fccc9311bb9ad5f9153217ecf84ff4777df4a
Reviewed-on: http://review.typo3.org/37316
Reviewed-by: Benjamin Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
---
 .../Controller/PermissionAjaxController.php   |  2 +-
 .../core/Classes/DataHandling/DataHandler.php |  5 ++++
 ...-DataHandlerStripslashesValuesProperty.rst | 28 +++++++++++++++++++
 3 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-65381-DataHandlerStripslashesValuesProperty.rst

diff --git a/typo3/sysext/beuser/Classes/Controller/PermissionAjaxController.php b/typo3/sysext/beuser/Classes/Controller/PermissionAjaxController.php
index 65a44a7000ac..351af7234004 100644
--- a/typo3/sysext/beuser/Classes/Controller/PermissionAjaxController.php
+++ b/typo3/sysext/beuser/Classes/Controller/PermissionAjaxController.php
@@ -77,7 +77,7 @@ class PermissionAjaxController {
 			// Init TCE for execution of update
 			/** @var $tce DataHandler */
 			$tce = GeneralUtility::makeInstance(DataHandler::class);
-			$tce->stripslashes_values = 1;
+			$tce->stripslashes_values = FALSE;
 			// Determine the scripts to execute
 			switch ($this->conf['action']) {
 				case 'show_change_owner_selector':
diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
index fc58b7d99804..b8f27511810a 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -88,6 +88,7 @@ class DataHandler {
 	 * unescaped data array instead. This switch may totally disappear in future versions of this class!
 	 *
 	 * @var bool
+	 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 	 */
 	public $stripslashes_values = TRUE;
 
@@ -1371,7 +1372,11 @@ class DataHandler {
 				$languageDeny = $GLOBALS['TCA'][$table]['ctrl']['languageField'] && (string)$GLOBALS['TCA'][$table]['ctrl']['languageField'] === (string)$field && !$this->BE_USER->checkLanguageAccess($fieldValue);
 				if (!$languageDeny) {
 					// Stripping slashes - will probably be removed the day $this->stripslashes_values is removed as an option...
+					// @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
 					if ($this->stripslashes_values) {
+						GeneralUtility::deprecationLog(
+							'The option stripslash_values is typically set to FALSE as data should be properly prepared before sending to DataHandler. Do not rely on DataHandler removing extra slashes. The option will be removed in TYPO3 CMS 8.'
+						);
 						if (is_array($fieldValue)) {
 							GeneralUtility::stripSlashesOnArray($fieldValue);
 						} else {
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65381-DataHandlerStripslashesValuesProperty.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65381-DataHandlerStripslashesValuesProperty.rst
new file mode 100644
index 000000000000..11490660942f
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65381-DataHandlerStripslashesValuesProperty.rst
@@ -0,0 +1,28 @@
+==========================================================================
+Deprecation: #65381 - Deprecate DataHandler property "stripslashes_values"
+==========================================================================
+
+Description
+===========
+
+The DataHandler property "stripslashes_values" is deprecated.
+
+Impact
+======
+
+A deprecation message is logged for every time DataHandler processes data if this property
+is set to TRUE.
+
+
+Affected installations
+======================
+
+All installations or extensions relying on the DataHandler property "stripslashes_values".
+
+
+Migration
+=========
+
+Set the "stripslashes_values" property to FALSE and apply stripslashes() in the code that
+prepares the data if it was expected that DataHandler stripped the slashes from incoming
+data.
\ No newline at end of file
-- 
GitLab