Skip to content

Commit

Permalink
Fix off by one error.
Browse files Browse the repository at this point in the history
Fixes #3094
  • Loading branch information
markstory committed Aug 4, 2012
1 parent c96e364 commit 73b1c0a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Cake/Console/Command/Task/ModelTask.php
Expand Up @@ -411,10 +411,12 @@ public function fieldValidation($fieldName, $metaData, $primaryKey = 'id') {
$this->hr();

$optionText = '';
for ($i = 1, $m = $defaultChoice / 2; $i < $m; $i++) {
for ($i = 1, $m = $defaultChoice / 2; $i <= $m; $i++) {
$line = sprintf("%2d. %s", $i, $this->_validations[$i]);
$optionText .= $line . str_repeat(" ", 31 - strlen($line));
$optionText .= sprintf("%2d. %s\n", $m + $i, $this->_validations[$m + $i]);
if ($m + $i !== $defaultChoice) {
$optionText .= sprintf("%2d. %s\n", $m + $i, $this->_validations[$m + $i]);
}
}
$this->out($optionText);
$this->out(__d('cake_console', "%s - Do not do any validation on this field.", $defaultChoice));
Expand Down

0 comments on commit 73b1c0a

Please sign in to comment.