Hi all,
i had some problems with the validation mechanism in cake 1.2, so i
went right into the code.
i learned that there is something that don't work as it supposed to
work.
if i have a model with the member
var $validate = array(
'alias' => array(
array(
'rule' => '/[a-z0-9 ]+/',
'message' => 'some error message'
)
)
);
you would assume that it would not accept something like: "FSD fsdf"
but it does!!
i don't only point to the problem but offer solution as well...
in model.php (cake core of course) line ~ 1744
now the code is:
$valid = preg_match($rule, $data[$fieldName]);
it should be something like:
$matches = array();
$valid = preg_match($rule, $data[$fieldName], $matches);
if($valid) {
$valid = strlen($matches[0]) == strlen($data[$fieldName]);
}
even optimized not to calculate string length if we didn't found any
matches :)
and to my question...
what is the expected functionality of the above code?
i'm not sure it's a bug. it all depends on what you expect of you app.
to me, this is the logical approach.
(I didn't find how to add a ticket so help on this issue is most
appreciated as well.)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---