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

Phalcon\Forms\Element::setLabel('0') render error #12148

Closed
pwoszczyk opened this issue Aug 16, 2016 · 3 comments
Closed

Phalcon\Forms\Element::setLabel('0') render error #12148

pwoszczyk opened this issue Aug 16, 2016 · 3 comments
Assignees
Milestone

Comments

@pwoszczyk
Copy link

Phalcon\Forms\Element::setLabel($label) render incorrect if $label = '0'.

Example:
$field = new Numeric('value');
$field->setLabel('0');
$field->label() // value

  • Phalcon version: 2.0.13
  • PHP Version: 5.6.11
  • Operating System: Windows 7
  • Installation type: precompiled dll
  • Server: Apache
@sergeyklay sergeyklay self-assigned this Aug 17, 2016
@pwoszczyk
Copy link
Author

Same on:

  • Phalcon version: 3.0.1
  • PHP Version: 7.0.8
  • Operating System: Ubuntu 16.04
  • Installation type: packagecloud.io
  • Server: Apache

@gguridi
Copy link
Contributor

gguridi commented Dec 29, 2016

I think it's fair to be able to associate '0' as label, in this case it shouldn't validate as empty label.

I tried to use empty label as condition because zephir documentation says that ‘Empty’ means the expression is null, is an empty string or an empty array. But that's not true and '0'also validates as false. So the only way to add '0' as a label is by explicitly check if it's numeric as condition.

Added a pull request with the change.

@sergeyklay sergeyklay added this to the 3.0.4 milestone Jan 3, 2017
@sergeyklay
Copy link
Contributor

Fixed in the 3.0.x branch.

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

3 participants