StringLength Validator [SOLVED]

Hi, i have some problem with StrLength validator: ```php $password = new Password('password', array('required' => true, 'class' => 'span12')); $password->addValidators(array( new PresenceOf(array( 'message' => 'password required', )), new StringLength(array( 'min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters' )), new Confirmation(array( 'message' => 'Password doesn\'t match confirmation', 'with' => 'repassword' )) )); ``` And i got error: ```php

0 Phalcon\Mvc\Model\Validator\StringLength->validate(Object(Phalcon\Validation), password)

1 Phalcon\Validation->validate(Array([id] => (empty string), [csrf] => a7ee72dcd676d63f5937876b2f6485c5, [login] => login, [name] => full name, [email] => [email protected], [role] => member, [password] => pass, [repassword] => pass), null)

2 Phalcon\Forms\Form->isValid(Array([id] => (empty string), [csrf] => a7ee72dcd676d63f5937876b2f6485c5, [login] => login, [name] => full name, [email] => [email protected], [role] => member, [password] => pass, [repassword] => pass))

``` Controller: ```php if($request->isPost()){ if($userForm->isValid($this->request->getPost())){ //.... } } ```



85.0k

Can you please print the message generated by the exception?

catch (Exception $e) {
  echo $e->getMessage();
  echo $e->getTraceAsString();
}


8.6k
( ! ) Fatal error: Uncaught exception 'BadMethodCallException' with message 'Wrong number of parameters' in C:\wamp\www\phalcon\app\modules\User\Controller\UserController.php on line 31
( ! ) BadMethodCallException: Wrong number of parameters in C:\wamp\www\phalcon\app\modules\User\Controller\UserController.php on line 31

line 31 Phalcon\Forms\Form->isValid( )

P.S. When i delete this validator validation was good



85.0k

This is your code: https://gist.github.com/phalcon/5961217 it's running here: http://test.phalconphp.com/form.php

Please let me know what change to see the exception



8.6k

Thx Phalcon. Problem was because I use ```php Phalcon\Mvc\Model\Validator\StringLength ``` not a ```php Phalcon\Validation\Validator\StringLength ```