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

Prevent invalid element name #12954

Merged
merged 4 commits into from
Aug 6, 2017
Merged

Prevent invalid element name #12954

merged 4 commits into from
Aug 6, 2017

Conversation

emiliodeg
Copy link
Contributor

@emiliodeg emiliodeg commented Jul 11, 2017

Prevent create form element with empty name value like ''

Hello!

  • Type: bug fix
  • Link to issue:

In raising this pull request, I confirm the following:

  • I have read and understood the Contributing Guidelines
  • I have checked that another pull request for this purpose does not exist.
  • I wrote some tests for this PR.

Small description of change:

Thanks

Prevent create form element with empty name value like ''
let name = trim(name);

if empty name {
throw new \InvalidArgumentException('Form element name is required');
Copy link
Contributor

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("...");

@sergeyklay
Copy link
Contributor

@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.

@emiliodeg
Copy link
Contributor Author

Hi @sergeyklay I trying to prevent this posible error

new \Phalcon\Form\Element\Text(''); // empty name
new \Phalcon\Form\Element\TextArea('      '); // empty name

@sergeyklay
Copy link
Contributor

@emiliodeg Anyway you have to use " " instead of ' '.

@sergeyklay sergeyklay added this to the 3.2.x milestone Jul 19, 2017
Copy link
Contributor

@sergeyklay sergeyklay left a 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

@sergeyklay sergeyklay merged commit b76284f into phalcon:3.2.x Aug 6, 2017
chilimatic pushed a commit to chilimatic/cphalcon that referenced this pull request Jan 15, 2018
* Prevent invalid element name

Prevent create form element with empty name value like ''

* trim name

* Update element.zep

* Update element.zep
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

Successfully merging this pull request may close these issues.

2 participants