View Issue Details

This issue affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
20506Bug reportsSurvey participants (Tokens)public2026-05-07 11:54
Reporterginosupport Assigned Totwilllig  
PrioritynoneSeverityblock 
Status closedResolutionfixed 
Product Version6.16.x 
Summary20506: Http 500 error with stacktrace when opening participants for survey
Description

I'm getting a HTTP 500 response with a stacktrace when opening the participants overview of surveys.

I have a feeling it's related to this change from the release notes:
+New feature #AT-1771: Added field type for additional attributes of survey participants (04609) (Tim Willig)

Steps To Reproduce

Steps to reproduce

There seems to be some form of environment specific situation, because i can reproduce the error consistently on 1 environment and can't reproduce it at all on another running the same version.

We're using a setup where all surveys are activated via the remotecontrol API with a participant table with a bunch of additional attributes. On the environment where it fails, all surveys have this problem. I can just select any survey and click the participants menu item and get an error.

Expected result

Screen loads normally

Actual result

Screen doesn't load. Logging shows a stacktrace

Stacktrace:
2026/05/05 15:07:03 [error] [php] Undefined array key "type" (/var/www/limesurvey/application/views/admin/token/attribute_subviews/tokenformAttributesWrapper.php:29)
Stack trace:
#0 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CBaseController.php(126): require()
#1 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CBaseController.php(95): AdminController->renderInternal()
#2 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CController.php(872): AdminController->renderFile()
#3 /var/www/limesurvey/application/controllers/AdminController.php(263): AdminController->renderPartial()
#4 /var/www/limesurvey/application/views/admin/token/massive_actions/_update.php(373): AdminController->renderPartial()
#5 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CBaseController.php(126): require()
#6 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CBaseController.php(95): AdminController->renderInternal()
#7 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CController.php(872): AdminController->renderFile()
#8 /var/www/limesurvey/application/controllers/AdminController.php(263): AdminController->renderPartial()
#9 /var/www/limesurvey/application/views/admin/token/massive_actions/_selector.php(40): AdminController->renderPartial()
#10 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CBaseController.php(126): require()
#11 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CBaseController.php(95): AdminController->renderInternal()
#12 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CController.php(872): AdminController->renderFile()
#13 /var/www/limesurvey/application/controllers/AdminController.php(263): AdminController->renderPartial()
#14 /var/www/limesurvey/application/controllers/admin/Tokens.php(146): AdminController->renderPartial()
#15 unknown(0): Tokens->index()
#16 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/actions/CAction.php(114): ReflectionMethod->invokeArgs()
#17 /var/www/limesurvey/application/core/SurveyCommonAction.php(86): Tokens->runWithParamsInternal()
#18 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CController.php(308): Tokens->runWithParams()
#19 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CController.php(286): AdminController->runAction()
#20 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CController.php(265): AdminController->runActionWithFilters()
#21 /var/www/limesurvey/application/controllers/AdminController.php(204): AdminController->run()
#22 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CWebApplication.php(282): AdminController->run()
#23 /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CWebApplication.php(141): LSYii_Application->runController()
#24 /var/www/limesurvey/vendor/yiisoft/yii/framework/base/CApplication.php(185): LSYii_Application->processRequest()
#25 /var/www/limesurvey/index.php(161): LSYii_Application->run()
REQUEST_URI=/index.php/admin/tokens/sa/index/surveyid/215493?1777986423145

TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)6.17.0+260421
I will donate to the project if issue is resolvedNo
Browser
Database type & versionPostgres 17
Server OS (if known)
Webserver software & version (if known)
PHP Version8.0.x

Users monitoring this issue

There are no users monitoring this issue.

Activities

lajosarpad

lajosarpad

2026-05-06 15:32

developer   ~84799

Thank you for your message. The problem is that in order to detect whether there is a bug to fix and if so, to fix it, we would need to know how to reproduce it, the exact steps to reproduce it. At this point we only know that your process crashes at application/views/admin/token/attribute_subviews/tokenformAttributesWrapper.php due to not having a type field at

        switch ($attrDescription['type']) {
            case 'DD':
                // Drop down
                $this->renderPartial(
                    '/admin/token/attribute_subviews/tokenformSelect',
                    [
                        'attrDescription' => $attrDescription,
                        'attrName' => $attrName,
                        'inputValue' => $inputValue,
                        'batchEdit' => $batchEdit,
                    ]
                );
                break;

            case 'DP':
                // Date
                $this->renderPartial(
                    '/admin/token/attribute_subviews/tokenformDateInput',
                    [
                        'attrDescription' => $attrDescription,
                        'attrName' => $attrName,
                        'inputValue' => $inputValue,
                        'jsDate' => $jsDate,
                        'batchEdit' => $batchEdit,
                    ]
                );
                break;

            default:
                // Text
                $this->renderPartial(
                    '/admin/token/attribute_subviews/tokenformTextInput',
                    [
                        'attrDescription' => $attrDescription,
                        'attrName' => $attrName,
                        'inputValue' => $inputValue,
                        'batchEdit' => $batchEdit,
                    ]
                );
                break;
        }

This value is being stored in your {{participant_attribute_names}} table in a field called attribute_type and we know for a fact that some of your tokens have no values there.

Possible reasons:

  1. Maybe the field is missing

If so, you'll need to create that field, you can inspire from this table definition (in MariaDB/MySQL):

CREATE TABLE `lime_participant_attribute_names` (
  `attribute_id` int(11) NOT NULL AUTO_INCREMENT,
  `attribute_type` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL,
  `defaultname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `visible` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL,
  `encrypted` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL,
  `core_attribute` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`attribute_id`,`attribute_type`),
  KEY `lime_idx_participant_attribute_names` (`attribute_id`,`attribute_type`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

and then run

update {{participant_attribute_names}} set attribute_type = 'TB' where attribute_type is null;
  1. You may have broken data

In this case the field exists for you, but some records have null as a value. If so, you can run the update command shared in the previous point

  1. There could be some bug otherwise. If so, we'll need exact steps on how a thusly broken survey is to be created.

    A symptomatic treatment of the problem would be to change the switch case I shared to

        switch ($attrDescription['type'] ?? '') {
            case 'DD':
                // Drop down
                $this->renderPartial(
                    '/admin/token/attribute_subviews/tokenformSelect',
                    [
                        'attrDescription' => $attrDescription,
                        'attrName' => $attrName,
                        'inputValue' => $inputValue,
                        'batchEdit' => $batchEdit,
                    ]
                );
                break;

            case 'DP':
                // Date
                $this->renderPartial(
                    '/admin/token/attribute_subviews/tokenformDateInput',
                    [
                        'attrDescription' => $attrDescription,
                        'attrName' => $attrName,
                        'inputValue' => $inputValue,
                        'jsDate' => $jsDate,
                        'batchEdit' => $batchEdit,
                    ]
                );
                break;

            default:
                // Text
                $this->renderPartial(
                    '/admin/token/attribute_subviews/tokenformTextInput',
                    [
                        'attrDescription' => $attrDescription,
                        'attrName' => $attrName,
                        'inputValue' => $inputValue,
                        'batchEdit' => $batchEdit,
                    ]
                );
                break;
        }

so it will infer a text type. However, at this point it's unclear why you ended up with an empty type and that needs to be figured out so your future attributes will not have this problem. As about your current attributes, you can just update the attribute_type to the appropriate value. If there are no other missing/broken elements in your attributes, then this update should fix the issue.

ginosupport

ginosupport

2026-05-06 16:42

reporter   ~84802

I will have a look at what my database looks like for these attributes. Will get back to you on that.

In the meantime, am i right in assuming that since this change was introduced in 6.17.0, i can safely update other instances to 6.16.17 without running into this?

twilllig

twilllig

2026-05-06 18:19

developer   ~84805

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=39629

LimeBot

LimeBot

2026-05-07 11:54

administrator   ~84808

Fixed in Release 6.17.2+260507

Related Changesets

LimeSurvey: master 9c352718

2026-05-06 18:18

twilllig

Committer: GitHub


Details Diff
Fixed issue 20506: Add default 'type' key to participant attribute arrays preventing undefined index errors (04955) Affected Issues
20506
mod - application/config/version.php Diff File
mod - application/controllers/admin/Tokens.php Diff File
mod - application/helpers/common_helper.php Diff File
add - application/helpers/update/updates/Update_650.php Diff File
mod - application/models/Survey.php Diff File

Issue History

Date Modified Username Field Change
2026-05-05 15:49 ginosupport New Issue
2026-05-06 08:33 twilllig Assigned To => twilllig
2026-05-06 08:33 twilllig Status new => assigned
2026-05-06 15:32 lajosarpad Note Added: 84799
2026-05-06 15:32 lajosarpad Bug heat 0 => 2
2026-05-06 16:42 ginosupport Note Added: 84802
2026-05-06 16:42 ginosupport Bug heat 2 => 4
2026-05-06 18:19 twilllig Changeset attached => LimeSurvey master 9c352718
2026-05-06 18:19 twilllig Note Added: 84805
2026-05-06 18:19 twilllig Status assigned => resolved
2026-05-06 18:19 twilllig Resolution open => fixed
2026-05-06 18:19 twilllig Bug heat 4 => 6
2026-05-07 11:54 LimeBot Note Added: 84808
2026-05-07 11:54 LimeBot Status resolved => closed
2026-05-07 11:54 LimeBot Bug heat 6 => 8