diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-11-15 11:24:52 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-11-15 11:24:52 +0100 |
commit | ef758bd67c45eb63485fbd2ea2b1d24aa2db1104 (patch) | |
tree | ab1e8999263cf88ec458ad15846375a7ff36c783 | |
parent | 20209d691062afe24ccc7887857618fbddecaa8c (diff) |
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.
-rw-r--r-- | system/libraries/Form_validation.php | 6 |
1 files changed, 5 insertions, 1 deletions
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) |