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.
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index b0ba8bb..7056558 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -670,7 +670,11 @@
// 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)