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

PHP Notice - Undefined variable: singles #25

Closed
al-bglhk opened this issue Feb 28, 2020 · 4 comments
Closed

PHP Notice - Undefined variable: singles #25

al-bglhk opened this issue Feb 28, 2020 · 4 comments

Comments

@al-bglhk
Copy link

al-bglhk commented Feb 28, 2020

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

  • Plugin version: 1.0.9
  • Craft version: 3.4.8

Suggested Action

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

@engram-design
Copy link
Member

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

@al-bglhk
Copy link
Author

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

image

@engram-design
Copy link
Member

Fixed in 1.0.11

@al-bglhk
Copy link
Author

al-bglhk commented Mar 2, 2020

Verified. Thank you!

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

2 participants