Skip to content

Commit

Permalink
Fixes #17220: Fixed widgets with no options
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Mar 23, 2019
1 parent 2abf5ec commit a7f9896
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Yii Framework 2 Change Log
==========================

2.0.18 under development
2.0.17.1 under development
------------------------

- no changes in this release.
- Bug #17220: Fixed widgets with no options (samdark)


2.0.17 March 22, 2019
Expand Down
4 changes: 4 additions & 0 deletions framework/widgets/ActiveField.php
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,10 @@ public function radioList($items, $options = [])
public function widget($class, $config = [])
{
foreach ($this->inputOptions as $key => $value) {
if (!isset($config['options'])) {

This comment has been minimized.

Copy link
@rob006

rob006 Mar 23, 2019

Contributor

It does not look right. Why this is inside of foreach? And would you need it in the first place?

This comment has been minimized.

Copy link
@samdark

samdark Mar 23, 2019

Author Member

Needed because $config['options'][$key] = $value; would fail in case there's no options key in $config.

This comment has been minimized.

Copy link
@samdark

samdark Mar 23, 2019

Author Member

In foreach because it's not needed otherwise.

This comment has been minimized.

Copy link
@rob006

rob006 Mar 23, 2019

Contributor

Needed because $config['options'][$key] = $value; would fail in case there's no options key in $config.

Nope. You can do such things in PHP without any warning: https://3v4l.org/fr4b5

This comment has been minimized.

Copy link
@samdark

samdark Mar 24, 2019

Author Member

You're absolutely right. Thanks! Reverted.

$config['options'] = [];
}

if (!isset($config['options'][$key])) {
$config['options'][$key] = $value;
}
Expand Down

0 comments on commit a7f9896

Please sign in to comment.