Bug Report #2969

Validation - :param1 doesn't get replaced with actual parameter

Added by Josip Jelic about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:06/16/2010
Priority:HighDue date:
Assignee:Jeremy Bush% Done:

0%

Category:Core
Target version:v3.0.7
Resolution:fixed Points:

Description

when using (for example):

->rule("password", "min_length", array('6'));

and error occures, error message is formed like this:

password must be at least :param1 characters long

Problem is introduced with 3.0.6, in 3.0.5. everything worked fine.

validate.diff Magnifier (583 Bytes) Daniel Enman, 06/18/2010 06:57 PM

validate.diff Magnifier (527 Bytes) Daniel Enman, 06/18/2010 10:45 PM


Related issues

Related to Kohana v3.x - Patch #2976: Patches :param# not being replaced in validation Closed 06/18/2010
Blocked by Kohana v3.x - Bug Report #2914: Add Value to Validation Messages Closed 06/04/2010

History

#1 Updated by Josip Jelic about 4 years ago

forgot to mention the obvious :)

:param1 doesn't get replaced with actual value (in this case '6')

#2 Updated by Dai Jobou about 4 years ago

Josip Jelic wrote:

->rule("password", "min_length", array('6'));

This working fine

protected $_rules = array
(
'password' => array
(
'not_empty' => NULL,
'min_length' => array(5),
'max_length' => array(42)
)
);

maybe array('6') => array(6) ?

#3 Updated by Josip Jelic about 4 years ago

Dai I don't quite understand what are you suggesting... I'm not validating an ORM model simply a form. This example looks like rules definition in ORM model.

You are right about integer type but I took this example beacuse it's in documentation that way:
->rule('password', 'min_length', array('6')) http://kohanaframework.org/guide/security.validation
However problem is not in Validation::min_length() but in errors().

#4 Updated by Daniel Enman about 4 years ago

I've patched my copy of validate.php and :param# is replaced now.

I've attached a copy of the .diff. Should I open a New Issue as a patch?

Dan

#5 Updated by Daniel Enman about 4 years ago

I've decided on a much better way to approach the patch. I will update it here (and in Patch #2976) when I have a couple of minutes.

#6 Updated by Daniel Enman about 4 years ago

Updated patch.

#7 Updated by Woody Gilk about 4 years ago

  • Status changed from New to Closed
  • Assignee set to Woody Gilk
  • Resolution set to fixed

#8 Updated by Woody Gilk about 4 years ago

  • Status changed from Closed to Needs Test
  • Assignee changed from Woody Gilk to Jeremy Bush
  • Resolution deleted (fixed)

This needs a unit test.

#9 Updated by Jeremy Bush about 4 years ago

  • Status changed from Needs Test to Closed
  • Resolution set to fixed

Also available in: Atom PDF