Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitizing Form::DATA_KEYS data type #26

Closed
maximkou opened this issue Jul 10, 2014 · 0 comments
Closed

Sanitizing Form::DATA_KEYS data type #26

maximkou opened this issue Jul 10, 2014 · 0 comments

Comments

@maximkou
Copy link

Hi! Thanks for good library.

In class Nette\Forms\Form declared 4 data type constants: DATA_TEXT, DATA_LINE, DATA_FILE, DATA_KEYS.

I create custom control and in overrided loaddHttpData method I set data type to DATA_KEYS.

$this->setValue($this->getHttpData(Nutnet_Form::DATA_KEYS));

But Nette\Forms\Helpers::sanitize method throws exception Nette\InvalidArgumentException('Unknown data type'), because for DATA_KEYS not exist sanitizer.

Field named like extraFields[image] and contains array(e.g. extraFields[image][name]). If named array parameter contains array value, library not sanitize this, it's seen in Nette\Forms\Helpers::extractHttpData method.

if (substr($htmlName, -2) === '[]') {
   // if key named, code here not executed
    ...
} else {
    // this is not sanitize DATA_KEYS
    return static::sanitize($itype, $data);
}

This is normally or you forgot add sanitizer and it's bug? (Nette/Forms 2.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant