From 5d05372f4f59d27fdd93249d813970fcf181a4af Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 20 Oct 2016 13:40:57 +0300 Subject: FV: throw BadMethodCallException when set_rules() called without --- user_guide_src/source/changelog.rst | 4 ++++ user_guide_src/source/libraries/form_validation.rst | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'user_guide_src/source') diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 3e7749f5b..4bff51a93 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -23,6 +23,10 @@ Release Date: Not Released - Removed the *socket_type* configuration setting from the 'redis' driver. - Changed data serialization logic in 'redis' driver for better performance. + - :doc:`Form Validation Library ` changes include: + + - Changed method ``set_rules()`` to throw a ``BadMethodCallException`` when its first parameter is not an array and the ``$rules`` one is unused. + - Database - Changed method ``initialize()`` to return void and instead throw a ``RuntimeException`` in case of failure. diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index 7792369b2..b503b9be0 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -1027,13 +1027,14 @@ Class Reference .. php:class:: CI_Form_validation - .. php:method:: set_rules($field[, $label = ''[, $rules = ''[, $errors = array()]]]) + .. php:method:: set_rules($field[, $label = null[, $rules = null[, $errors = array()]]]) :param string $field: Field name :param string $label: Field label :param mixed $rules: Validation rules, as a string list separated by a pipe "|", or as an array or rules :param array $errors: A list of custom error messages :returns: CI_Form_validation instance (method chaining) + :throws: BadMethodCallException If $field is not an array and $rules was not used :rtype: CI_Form_validation Permits you to set validation rules, as described in the tutorial -- cgit v1.2.3-24-g4f1b