-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Prevent invalid element name #12954
Prevent invalid element name #12954
Conversation
Prevent create form element with empty name value like ''
phalcon/forms/element.zep
Outdated
let name = trim(name); | ||
|
||
if empty name { | ||
throw new \InvalidArgumentException('Form element name is required'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new \InvalidArgumentException('...');
=>throw new \InvalidArgumentException("...");
@emiliodeg What do you want to fix? Could you please describe a bit more the issue? Also can you create a small test which will cover code you have changed? Thank you for contributing. |
Hi @sergeyklay I trying to prevent this posible error new \Phalcon\Form\Element\Text(''); // empty name
new \Phalcon\Form\Element\TextArea(' '); // empty name |
@emiliodeg Anyway you have to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emiliodeg Looks good to me. Could you please update the CHANGELOG.md
* Prevent invalid element name Prevent create form element with empty name value like '' * trim name * Update element.zep * Update element.zep
Prevent create form element with empty name value like ''
Hello!
In raising this pull request, I confirm the following:
Small description of change:
Thanks