verbb / expanded-singles

Craft CMS plugin to list Singles in the sidebar when editing Entries.
MIT License
53 stars 6 forks source link

PHP Notice - Undefined variable: singles #25

Closed al-bglhk closed 4 years ago

al-bglhk commented 4 years ago

Description

I am getting thrown a PHP Notice – yii\base\ErrorException whenever I create a new Entry i.e. Blog Post.

It breaks because $single isn't defined outside the for-loop. And then you're accessing the variable-on-the-fly outside of the loop. If there are no singles, the variable fails.

Steps to reproduce

  1. Install and enable verbb/expanded-singles:1.0.9 plugin
  2. Create a new Entry.

Additional info

Suggested Action

Declare the $single variable before the loop. Like this diff https://gist.github.com/al-bglhk/3a80c015203a0b72bd5b4b4e11f2a059

engram-design commented 4 years ago

Not sure how I missed that, but thanks! Fixed in 1.0.10

al-bglhk commented 4 years ago

The problem is still there. the createSectionedSinglesList method still misses the $singles declaration.

image
engram-design commented 4 years ago

Fixed in 1.0.11

al-bglhk commented 4 years ago

Verified. Thank you!