8000 Enableable ArrayNodeDefinition is disabled for empty configuration by mateuszsip · Pull Request #25789 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Enableable ArrayNodeDefinition is disabled for empty configuration #25789

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 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
simplified expression
  • Loading branch information
mateuszsip committed Jan 15, 2018
commit 920eb330da6a451b590a0d8d833db1d9d41dbe91
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public function canBeEnabled()
->ifArray()
->then(function ($v) {
if (!isset($v['enabled'])) {
$v['enabled'] = empty($v) ? false : true;
$v['enabled'] = !empty($v);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably be is_array($v) && !empty($v) to cover the foo: ~ case, which should work as enable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What tests should we add to make sure it won't happen in the future? Component tests cover null case already. ~ is just a null, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

forget my comment. This callback is only triggered for arrays ;)

Copy link
Contributor Author
@mateuszsip mateuszsip Jan 21, 2018

Choose a reason for hiding this comment

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

Looks like ~ in yaml is represented by empty array (?), simple reproducer is available here

}

return $v;
Expand Down
0