From 56d1efc5b14d7bd5a92800ba9394bf9201d48b61 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 14 Dec 2016 12:32:32 +0200 Subject: Move 'standardize_newlines' proc out of CI_Input::_clean_input_data() Preparation for CI_Input::_sanitize_globals() removal. Also, WTF?! I'm deprecating this functionality in 3.1.next. --- system/core/Input.php | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'system') diff --git a/system/core/Input.php b/system/core/Input.php index 2e38e4501..ec57cd448 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -66,15 +66,6 @@ class CI_Input { */ protected $_allow_get_array = TRUE; - /** - * Standardize new lines flag - * - * If set to TRUE, then newlines are standardized. - * - * @var bool - */ - protected $_standardize_newlines; - /** * Enable XSS flag * @@ -140,7 +131,6 @@ class CI_Input { $this->_allow_get_array = (config_item('allow_get_array') === TRUE); $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); $this->_enable_csrf = (config_item('csrf_protection') === TRUE); - $this->_standardize_newlines = (bool) config_item('standardize_newlines'); $this->security =& load_class('Security', 'core'); @@ -159,6 +149,13 @@ class CI_Input { $this->security->csrf_verify(); } + if ( ! empty($_POST) && config_item('standardize_newlines') === TRUE) + { + array_walk_recursive($_POST, function(&$value) { + $value = preg_replace('/(?:\r\n|[\r\n])/', PHP_EOL, $value); + }); + } + log_message('info', 'Input Class Initialized'); } @@ -595,7 +592,6 @@ class CI_Input { * * - Unsets $_GET data, if query strings are not enabled * - Cleans POST, COOKIE and SERVER data - * - Standardizes newline characters to PHP_EOL * * @return void */ @@ -698,12 +694,6 @@ class CI_Input { // Remove control characters $str = remove_invisible_characters($str, FALSE); - // Standardize newlines if needed - if ($this->_standardize_newlines === TRUE) - { - return preg_replace('/(?:\r\n|[\r\n])/', PHP_EOL, $str); - } - return $str; } -- cgit v1.2.3-24-g4f1b