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

Empty Sets are throwing an exception #1787

krausste opened this Issue Feb 19, 2018 · 3 comments


None yet
3 participants

krausste commented Feb 19, 2018

Expected behaviour

Inside the replicator or bard fieldtype I want to be able to define sets that dont have any fields inside.

Actual behaviour

Statamic crash when opening a related fieldset.

Steps to reproduce

  1. Create a new fieldset
  2. Add e.g. a bard field
  3. Add a set and leave the set empty (don't add any fields)

Server Details

Statamic Version: 2.8.5

Updated from an older Statamic or fresh install: Update from 2.8.3


``` ErrorException in Fieldset.php line 220: Undefined index: fields in Fieldset.php line 220 at HandleExceptions->handleError('8', 'Undefined index: fields', '/server/www/apache/html/statamic/core/CP/Fieldset.php', '220', array('item' ```


Following patch is fixing the issue for us at the moment:

Subject: [PATCH] Fixed undefined index exception for sets with no fields

 statamic/statamic/core/CP/Fieldset.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/statamic/statamic/core/CP/Fieldset.php b/statamic/statamic/core/CP/Fieldset.php
index 48825597e..f54100cfc 100644
--- a/statamic/statamic/core/CP/Fieldset.php
+++ b/statamic/statamic/core/CP/Fieldset.php
@@ -217,7 +217,9 @@ class Fieldset implements FieldsetContract
             } elseif ($sets = array_get($item, 'sets')) {
                 foreach ($sets as $set => $config) {
-                    $sets[$set]['fields'] = $this->inlinePartials($config['fields']);
+                    if (isset($config['fields'])) {
+                        $sets[$set]['fields'] = $this->inlinePartials($config['fields']);
+                    }
                 $item['sets'] = $sets;

This comment has been minimized.


jackmcdade commented Feb 19, 2018

What is a use case for a Replicator set without any fields?


This comment has been minimized.

krausste commented Feb 19, 2018

we have two use cases:

  • Separator(s)
  • Definition of a special position

@jackmcdade jackmcdade assigned jaggy and unassigned jaggy Feb 20, 2018


This comment has been minimized.


jackmcdade commented Feb 21, 2018

Fixed for next release.

@jackmcdade jackmcdade closed this Feb 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment