From ef758bd67c45eb63485fbd2ea2b1d24aa2db1104 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 15 Nov 2012 12:24:52 +0200 Subject: Revert a change from 7a7ad782b2f125622509a77c5a6f94ad4ae0f93c sscanf() is lightning fast, but doesn't have such thing as greediness and this breaks rule parameters containing a closing square bracket. --- system/libraries/Form_validation.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'system/libraries') diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index b0ba8bbcb..7056558c5 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -670,7 +670,11 @@ class CI_Form_validation { // Strip the parameter (if exists) from the rule // Rules can contain a parameter: max_length[5] $param = FALSE; - sscanf($rule, '%[^[][%[^]]', $rule, $param); + if (preg_match('/(.*?)\[(.*)\]/', $rule, $match)) + { + $rule = $match[1]; + $param = $match[2]; + } // Call the function that corresponds to the rule if ($callback === TRUE) -- cgit v1.2.3-24-g4f1b