Skip to content

Commit 2b5e6c3

Browse files
committed
TextBase: input is not silently truncated to max-length
1 parent cccba57 commit 2b5e6c3

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

src/Forms/Controls/TextBase.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ public function setValue($value)
5555
public function getValue()
5656
{
5757
$value = $this->value;
58-
if (!empty($this->control->maxlength)) {
59-
$value = Strings::substring($value, 0, $this->control->maxlength);
60-
}
6158
foreach ($this->filters as $filter) {
6259
$value = (string) call_user_func($filter, $value);
6360
}

tests/Forms/Controls.TextBase.loadData.phpt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -141,28 +141,6 @@ test(function() { // non float
141141
});
142142

143143

144-
test(function() { // max length
145-
$_POST = array('long' => ' žluťoučký');
146-
147-
$form = new Form;
148-
$input = $form->addText('long')
149-
->addRule($form::MAX_LENGTH, NULL, 5);
150-
151-
Assert::same( 'žluťo', $input->getValue() );
152-
});
153-
154-
155-
test(function() { // max length
156-
$_POST = array('long' => ' žluťoučký');
157-
158-
$form = new Form;
159-
$input = $form->addTextArea('long')
160-
->addRule($form::MAX_LENGTH, NULL, 5);
161-
162-
Assert::same( ' žluť', $input->getValue() );
163-
});
164-
165-
166144
test(function() { // URL
167145
$_POST = array('url' => 'nette.org');
168146

0 commit comments

Comments
 (0)