Have a look at my original report, it can probably help :
$val = Validation::factory('login_user');
$val->add('username', 'Username')
->add_rule('valid_string', array('alpha', 'numeric', 'dashes', 'dots'));
the valid_string rule takes an array as argument. The problem is that the get_message() function of the Validation_Error class uses str_replace() to assign to each param a value. Which can eventually be an array (as shown in the example above).
In order to reproduce this issue, you will need to use a custom error message, because with the default message, the function returns earlier (line 102).
As a temporary fix, I flattened the $params array before entering the foreach loop (line 113). We can achieve that by writing something like this :
$this->params = $this->flatten_array($this->params); //added line
foreach($this->params as $key => $val)
{
$find[] = ':param:'.($key + 1);
$replace[] = $val;
}
Then we can define the flatten_array function (for instance) as :
function flatten_array(array $array)
{
$flat_array = array();
foreach(new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array)) as $value)
{
$flat_array[] = $value;
}
return $flat_array;
}
This is a fix that implies modifying the Fuel core, which is not that great (http://scrp.at/Uu). I didn't check if the bug was fixed in the RC2 version yet. But it seems the Validation_Error class hasn't changed so much.
Good luck!
thanks again & happy easter: jan. It looks like you're new here. If you want to get involved, click one of these buttons!