From 37c4cc599698da0634d620665491fc27e9a36beb Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Dec 2016 15:33:42 +0200 Subject: Remove previously deprecated Form Helper function form_prep() --- system/helpers/form_helper.php | 19 ------------------- tests/codeigniter/helpers/form_helper_test.php | 16 ---------------- user_guide_src/source/changelog.rst | 9 +++++---- user_guide_src/source/helpers/form_helper.rst | 17 ----------------- user_guide_src/source/installation/upgrade_300.rst | 4 ++-- user_guide_src/source/installation/upgrade_320.rst | 1 + 6 files changed, 8 insertions(+), 58 deletions(-) diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index aa7379f77..9756437ae 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -653,25 +653,6 @@ if ( ! function_exists('form_close')) // ------------------------------------------------------------------------ -if ( ! function_exists('form_prep')) -{ - /** - * Form Prep - * - * Formats text so that it can be safely placed in a form field in the event it has HTML tags. - * - * @deprecated 3.0.0 An alias for html_escape() - * @param string|string[] $str Value to escape - * @return string|string[] Escaped values - */ - function form_prep($str) - { - return html_escape($str, TRUE); - } -} - -// ------------------------------------------------------------------------ - if ( ! function_exists('set_value')) { /** diff --git a/tests/codeigniter/helpers/form_helper_test.php b/tests/codeigniter/helpers/form_helper_test.php index b5fe99b96..4ecfaa5f7 100644 --- a/tests/codeigniter/helpers/form_helper_test.php +++ b/tests/codeigniter/helpers/form_helper_test.php @@ -271,20 +271,4 @@ EOH; $this->assertEquals($expected, form_close('')); } - - // ------------------------------------------------------------------------ - - public function test_form_prep() - { - $this->assertEquals( - 'Here is a string containing "quoted" text.', - form_prep('Here is a string containing "quoted" text.') - ); - - $this->assertEquals( - 'Here is a string containing a <tag>.', - form_prep('Here is a string containing a .', TRUE) - ); - } - } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index b6ef1db95..2dcb0b1af 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -18,6 +18,7 @@ Release Date: Not Released - Removed previously deprecated :doc:`HTML Helper ` functions ``br()`` and ``nbs()`` (use PHP's native ``str_repeat()`` with ``'
'`` and ``' '`` respectively). - Removed previously deprecated :doc:`String Helper ` functions ``trim_slashes()`` and ``repeater()`` (use PHP's native ``trim()`` with ``'/'`` and ``str_repeat()`` respectively). - Removed previously deprecated :doc:`File Helper ` function ``read_file()`` (use PHP's native ``file_get_contents()`` instead). + - Removed previously deprecated :doc:`Form Helper ` function ``form_prep()`` (use :php:func:`html_escape()` instead). - Removed previously deprecated *Email Helper* (had only two functions, aliases for PHP's native ``filter_var()`` and ``mail()``). - Libraries @@ -550,7 +551,7 @@ Release Date: March 30, 2015 - :doc:`Form Helper ` changes include: - :php:func:`form_dropdown()` will now also take an array for unity with other form helpers. - - :php:func:`form_prep()` is now DEPRECATED and only acts as an alias for :doc:`common function ` :php:func:`html_escape()`. + - ``form_prep()`` is now DEPRECATED and only acts as an alias for :doc:`common function ` :php:func:`html_escape()`. - :php:func:`set_value()` will now also accept a third argument, allowing to turn off HTML escaping of the value. - :doc:`Security Helper ` changes include: @@ -1994,7 +1995,7 @@ Hg Tag: v1.7.2 - Modified form_hidden() in the :doc:`Form helper ` to accept multi-dimensional arrays. - - Modified form_prep() in the :doc:`Form + - Modified ``form_prep()`` in the :doc:`Form helper ` to keep track of prepped fields to avoid multiple prep/mutation from subsequent calls which can occur when using Form Validation and form helper functions to @@ -2053,7 +2054,7 @@ Bug fixes for 1.7.2 - Fixed a case sensitive string replacement in xss_clean() - Fixed a bug in form_textarea() where form data was not prepped correctly. -- Fixed a bug in form_prep() causing it to not preserve entities in +- Fixed a bug in ``form_prep()`` causing it to not preserve entities in the user's original input when called back into a form element - Fixed a bug in _protect_identifiers() where the swap prefix ($swap_pre) was not being observed. @@ -3142,7 +3143,7 @@ Release Date: October 30, 2006 - Fixed a bug in the validation class. - Fixed a bug in the typography helper that was incorrectly wrapping block level elements in paragraph tags. -- Fixed a problem in the form_prep() function that was double encoding +- Fixed a problem in the ``form_prep()`` function that was double encoding entities. - Fixed a bug that affects some versions of PHP when output buffering is nested. diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index bc30a0e98..cf52cd523 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -724,20 +724,3 @@ The following functions are available: The "password" field doesn't match the "repeat_password" field! */ - -.. php:function:: form_prep($str) - - :param string $str: Value to escape - :returns: Escaped value - :rtype: string - - Allows you to safely use HTML and characters such as quotes within form - elements without breaking out of the form. - - .. note:: If you use any of the form helper functions listed in this page the form - values will be prepped automatically, so there is no need to call this - function. Use it only if you are creating your own form elements. - - .. note:: This function is DEPRECATED and is just an alias for - :doc:`common function <../general/common_functions>` - :func:`html_escape()` - please use that instead. diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index c7c2b948a..35f5621cd 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -643,8 +643,8 @@ scheduled for removal in CodeIgniter 3.1+. Form helper form_prep() ======================= -:doc:`Form Helper <../helpers/form_helper>` function :php:func:`form_prep()` -is now just an alias for :doc:`common function ` +:doc:`Form Helper <../helpers/form_helper>` function ``form_prep()`` is now +just an alias for :doc:`common function ` :func:`html_escape()`. It is deprecated and will be removed in the future. Please use :php:func:`html_escape()` instead. diff --git a/user_guide_src/source/installation/upgrade_320.rst b/user_guide_src/source/installation/upgrade_320.rst index 5cf2acd3b..6107d084b 100644 --- a/user_guide_src/source/installation/upgrade_320.rst +++ b/user_guide_src/source/installation/upgrade_320.rst @@ -144,6 +144,7 @@ version 3.0.0, that have been removed in 3.2.0: - ``trim_slashes()`` :doc:`String Helper <../helpers/string_helper>` function (use ``trim()`` with ``'/'`` instead) - ``repeater()`` :doc:`String Helper <../helpers/string_helper>` function (use ``str_repeat()`` instead) - ``read_file()`` :doc:`File Helper <../helpers/file_helper>` function (use ``file_get_contents()`` instead) +- ``form_prep()`` :doc:`Form Helper <../helpers/form_helper>` function (use :php:func:`html_escape()` instead) - The entire *Email Helper*, which only had two functions: -- cgit v1.2.3-24-g4f1b