Permalink
Browse files

Revert a change from 7a7ad78

sscanf() is lightning fast, but doesn't have such thing as greediness and this breaks rule parameters containing a closing square bracket.
  • Loading branch information...
1 parent 20209d6 commit ef758bd67c45eb63485fbd2ea2b1d24aa2db1104 @narfbg narfbg committed Nov 15, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 system/libraries/Form_validation.php
@@ -670,7 +670,11 @@ protected function _execute($row, $rules, $postdata = NULL, $cycles = 0)
// 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)

0 comments on commit ef758bd

Please sign in to comment.