Skip to content

[Form] fixed bug - name in ButtonBuilder #19306

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

Closed
wants to merge 2 commits into from

Conversation

cheprasov
Copy link
Contributor

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Bug:

For any scalar of name, expression empty($name) && 0 != $name is never true,
and as result - empty string ('') is allowed.

Examples:

$name = ''; var_dump(empty($name) && 0 != $name); // false
$name = '0'; var_dump(empty($name) && 0 != $name); // false
$name = null; var_dump(empty($name) && 0 != $name); // false
$name = false; var_dump(empty($name) && 0 != $name); // false
$name = 0; var_dump(empty($name) && 0 != $name); // false

{
/**
* @return array
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need for the docblocks in tests.

@cheprasov
Copy link
Contributor Author

@xabbuh
Fixed.

@xabbuh
Copy link
Member

xabbuh commented Jul 8, 2016

👍

@fabpot
Copy link
Member

fabpot commented Jul 8, 2016

Thank you @cheprasov.

fabpot added a commit that referenced this pull request Jul 8, 2016
This PR was squashed before being merged into the 2.7 branch (closes #19306).

Discussion
----------

[Form] fixed bug - name in ButtonBuilder

| Q             | A
| ------------- | ---
| Branch?       |  2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? |no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

**Bug:**

For any scalar of name, expression `empty($name) && 0 != $name` is never true,
and as result - empty string ('') is allowed.

**Examples:**

```php
$name = ''; var_dump(empty($name) && 0 != $name); // false
$name = '0'; var_dump(empty($name) && 0 != $name); // false
$name = null; var_dump(empty($name) && 0 != $name); // false
$name = false; var_dump(empty($name) && 0 != $name); // false
$name = 0; var_dump(empty($name) && 0 != $name); // false
```

Commits
-------

f507023 [Form] fixed bug - name in ButtonBuilder
@fabpot fabpot closed this Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants