Skip to content

Commit

Permalink
Don't generate maxlength properties for decimal columns.
Browse files Browse the repository at this point in the history
Int casting the decimal scale isn't going to work in a number of
situations as users may end up trying to include decimal points, commas
or spaces in larger amounts.

Fixes #5977
  • Loading branch information
markstory committed Feb 28, 2015
1 parent 54edb1c commit 8dba987
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion lib/Cake/Test/Case/View/Helper/FormHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,6 @@ public function testTextFieldGenerationForDecimalAsText() {
'type' => 'text',
'name' => 'data[ValidateUser][cost_decimal]',
'id' => 'ValidateUserCostDecimal',
'maxlength' => 6,
)),
'/div'
);
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/View/Helper/FormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,7 @@ protected function _maxLength($options) {
isset($fieldDef['length']) &&
is_scalar($fieldDef['length']) &&
$fieldDef['length'] < 1000000 &&
$fieldDef['type'] !== 'decimal' &&
$options['type'] !== 'select'
);
if ($autoLength &&
Expand Down

0 comments on commit 8dba987

Please sign in to comment.