I’ve been trying out this extension of the Form Validation Class and it was working as intended until I came to an error where I wanted to callback a validation function that was in the controller.
If my callback was “callback_user_model->isEmailUnque”, that would work fine. But if I was to instead have a callback like “callback_controllerCheckFunc”, it just would not recognise it
Does anyone know if this extension was meant to have callbacks done via the model ONLY?
Anyhows I had managed to find the problem which was the IF statement at line 238
if (list($class, $method) = split('->', $rule))
{
if ( ! method_exists($parent->$class, $method))
{
continue;
}
$result = $parent->$class->$method($postdata, $param);
}
else
{
if ( ! method_exists($parent, $rule))
{
continue;
}
$result = $parent->$rule($postdata, $param);
}
Turns about the IF statement(Line 238) was returning TRUE regardless if the rule had “->” or not.
I’ve changed Line 238 to the following
list($class, $method) = split('->', $rule);
if (!empty ($class) && !empty ($method))
{
if ( ! method_exists($parent->$class, $method))
{
continue;
}
$result = $parent->$class->$method($postdata, $param);
}
else
{
if ( ! method_exists($parent, $rule))
{
continue;
}
$result = $parent->$rule($postdata, $param);
}
That should now check it explicitly now.
Can anyone confirm if I am on the right path here or have I just totally misunderstood the problem I was facing and fixed it unnessary?
