View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
19782Bug reportsQuestion themepublic2024-10-04 09:22
Reporterjavifinarfin Assigned To 
PrioritynoneSeveritypartial_block 
Status newResolutionopen 
Product Version6.5.x 
Summary19782: Question theme attributes with options fail to load
Description

The config.xml parsing process is different when is done to questions than when is done to question themes

Steps To Reproduce

Duplicate multipleshorttext with the intention to create a question_theme. Change the name on config.xml to match the new folder and provide a new name. Keep everything else the same

After enabling via configuration the new question_theme, when trying to select it, Limesurvey will make a request to:
https://mylimesurvey/index.php/questionAdministration/getAdvancedSettingsHTML?surveyId=198286&questionId=0&questionType=Q&questionTheme=my-multiple-short-text-question-theme

It will show a "Internal error in updateQuestionAttributes: [object Object] question theme" via alert and the request will fail with a 500 and the following stacktrace:

{
"success": false,
"message": "Illegal offset type in isset or empty",
"error": {
"code": 500,
"type": "TypeError",
"errorCode": 0,
"message": "Illegal offset type in isset or empty",
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/i18n\/CMessageSource.php",
"line": 104,
"trace": "#0 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/i18n\/CMessageSource.php(85): CMessageSource->translateMessage()\n#1 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/YiiBase.php(620): CMessageSource->translate()\n#2 \/var\/www\/html\/application\/helpers\/common_helper.php(30): YiiBase::t()\n#3 \/var\/www\/html\/application\/extensions\/AdvancedSettingWidget\/views\/buttongroup.php(16): gT()\n#4 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CBaseController.php(126): require('...')\n#5 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CBaseController.php(95): CBaseController->renderInternal()\n#6 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/widgets\/CWidget.php(244): CBaseController->renderFile()\n#7 \/var\/www\/html\/application\/extensions\/AdvancedSettingWidget\/AdvancedSettingWidget.php(56): CWidget->render()\n#8 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CBaseController.php(182): AdvancedSettingWidget->run()\n#9 \/var\/www\/html\/application\/views\/questionAdministration\/advancedSettings.php(31): CBaseController->widget()\n#10 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CBaseController.php(126): require('...')\n#11 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CBaseController.php(95): CBaseController->renderInternal()\n#12 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CController.php(872): CBaseController->renderFile()\n#13 \/var\/www\/html\/application\/controllers\/QuestionAdministrationController.php(1842): CController->renderPartial()\n#14 [internal function]: QuestionAdministrationController->actionGetAdvancedSettingsHTML()\n#15 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/actions\/CAction.php(114): ReflectionMethod->invokeArgs()\n#16 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/actions\/CInlineAction.php(47): CAction->runWithParamsInternal()\n#17 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CController.php(308): CInlineAction->runWithParams()\n#18 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CController.php(286): CController->runAction()\n#19 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CController.php(265): CController->runActionWithFilters()\n#20 \/var\/www\/html\/application\/controllers\/LSBaseController.php(145): CController->run()\n#21 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CWebApplication.php(282): LSBaseController->run()\n#22 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CWebApplication.php(141): CWebApplication->runController()\n#23 \/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/base\/CApplication.php(185): CWebApplication->processRequest()\n#24 \/var\/www\/html\/index.php(161): CApplication->run()\n#25 {main}",
"traces": [
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/i18n\/CMessageSource.php",
"line": 85,
"function": "translateMessage",
"class": "CMessageSource",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/YiiBase.php",
"line": 620,
"function": "translate",
"class": "CMessageSource",
"type": "->"
},
{
"file": "\/var\/www\/html\/application\/helpers\/common_helper.php",
"line": 30,
"function": "t",
"class": "YiiBase",
"type": "::"
},
{
"file": "\/var\/www\/html\/application\/extensions\/AdvancedSettingWidget\/views\/buttongroup.php",
"line": 16,
"function": "gT"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CBaseController.php",
"line": 126,
"args": [
"\/var\/www\/html\/application\/extensions\/AdvancedSettingWidget\/views\/buttongroup.php"
],
"function": "require"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CBaseController.php",
"line": 95,
"function": "renderInternal",
"class": "CBaseController",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/widgets\/CWidget.php",
"line": 244,
"function": "renderFile",
"class": "CBaseController",
"type": "->"
},
{
"file": "\/var\/www\/html\/application\/extensions\/AdvancedSettingWidget\/AdvancedSettingWidget.php",
"line": 56,
"function": "render",
"class": "CWidget",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CBaseController.php",
"line": 182,
"function": "run",
"class": "AdvancedSettingWidget",
"type": "->"
},
{
"file": "\/var\/www\/html\/application\/views\/questionAdministration\/advancedSettings.php",
"line": 31,
"function": "widget",
"class": "CBaseController",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CBaseController.php",
"line": 126,
"args": [
"\/var\/www\/html\/application\/views\/questionAdministration\/advancedSettings.php"
],
"function": "require"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CBaseController.php",
"line": 95,
"function": "renderInternal",
"class": "CBaseController",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CController.php",
"line": 872,
"function": "renderFile",
"class": "CBaseController",
"type": "->"
},
{
"file": "\/var\/www\/html\/application\/controllers\/QuestionAdministrationController.php",
"line": 1842,
"function": "renderPartial",
"class": "CController",
"type": "->"
},
{
"function": "actionGetAdvancedSettingsHTML",
"class": "QuestionAdministrationController",
"type": "->",
"file": "unknown",
"line": 0
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/actions\/CAction.php",
"line": 114,
"function": "invokeArgs",
"class": "ReflectionMethod",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/actions\/CInlineAction.php",
"line": 47,
"function": "runWithParamsInternal",
"class": "CAction",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CController.php",
"line": 308,
"function": "runWithParams",
"class": "CInlineAction",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CController.php",
"line": 286,
"function": "runAction",
"class": "CController",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CController.php",
"line": 265,
"function": "runActionWithFilters",
"class": "CController",
"type": "->"
},
{
"file": "\/var\/www\/html\/application\/controllers\/LSBaseController.php",
"line": 145,
"function": "run",
"class": "CController",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CWebApplication.php",
"line": 282,
"function": "run",
"class": "LSBaseController",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/web\/CWebApplication.php",
"line": 141,
"function": "runController",
"class": "CWebApplication",
"type": "->"
},
{
"file": "\/var\/www\/html\/vendor\/yiisoft\/yii\/framework\/base\/CApplication.php",
"line": 185,
"function": "processRequest",
"class": "CWebApplication",
"type": "->"
},
{
"file": "\/var\/www\/html\/index.php",
"line": 161,
"function": "run",
"class": "CApplication",
"type": "->"
}
]
}
}

After some debugging, I arrived that translateMessage receive this structure:
Array ( [0] => Array ( [value] => Array ( [0] => 0 [1] => Hidden ) ) [1] => Array ( [value] => Array ( [0] => 1 [1] => Disabled ) ) )
Instead of this one:
Array ( [0] => Hidden [1] => Disabled )

Now, I think the problem is that when being a question_theme, it goes via here:
https://github.com/LimeSurvey/LimeSurvey/blob/6.5.11%2B240605/application/models/QuestionTheme.php#L1014

But not through here:
https://github.com/LimeSurvey/LimeSurvey/blob/5.6.11%2B230320/application/models/QuestionAttribute.php#L497

That line, I think is the code point where one structure is transformed into the other

As a workaround, I have changed my config.xml so the options are stored like this:

<options>
<option>Hidden</option>
<option>Disabled</option>
</options>

Instead of:

<options>
<option>
<value>0</value>
<value>Hidden</value>
</option>
<option>
<value>1</value>
<value>Disabled</value>
</option>
</options>

I think that I´ll be safe as long as I´m not using a value different from a number (but I have seen already a "hidden" value for field label_input_columns )

Hope with all this info is easy to solve

TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)6.5.11
I will donate to the project if issue is resolvedNo
BrowserChrome
Database type & versionPostgreSQL
Server OS (if known)
Webserver software & version (if known)
PHP Version8.1.30

Users monitoring this issue

DenisChenu

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2024-10-02 11:15 javifinarfin New Issue
2024-10-04 09:22 DenisChenu Issue Monitored: DenisChenu
2024-10-04 09:22 DenisChenu Bug heat 0 => 2