bonny / WordPress-Simple-Fields

WordPress plugin that extend Custom Fields to include textareas, WYSIWYG-editor, files, attachments, well basically anything
http://wordpress.org/extend/plugins/simple-fields/
88 stars 23 forks source link

Prevent foreach error #106

Closed aronbudinszky closed 9 years ago

aronbudinszky commented 9 years ago

When the specified field group did not exist, foreach ran into an error since field_group was not an array. A check has been added to prevent this so that it simply returns an empty array in this case.

You can reproduce this error in earlier versions by calling simple_fields_fieldgroup() with a non-existant field group id or slug.

tersmitten commented 9 years ago

We see the same error (a lot):

PHP Warning:  Invalid argument supplied for foreach() in /var/www/wp-content/plugins/simple-fields/functions.php on line 1
838

Please merge the pull request.

bonny commented 9 years ago

Thanks for the pull request. I never got that error, but if you got it and this solved it, I'm happy to merge. :)

aronbudinszky commented 9 years ago

Thanks!

bonny commented 9 years ago

Can any of you who had the problem try the current master and see if it works?