View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
16508Bug reportsTheme editorpublic2020-08-12 10:10
Reportergabrieljenik Assigned Togabrieljenik  
PrioritynoneSeveritycrash 
Status closedResolutionfixed 
Product Version4.3.4 
Summary16508: Can't run survey with child theme because of enheritance problems.
Description

Cloned from 16498. This one applies to v4

When running the small attached test survey with the fruity theme, everything is working fine. If I extend fruity and add another theme option to the options.twig and config.xml file, the same survey is broken when switching to the new theme.
Funny thing: If, at survey level, I set the theme options to "Inherit everything" -> NO without adjusting any details, that survey is working fine again.

So my guess is that either I am too stupid to add a custom setting or something with the inheritance feature is wrong.

Steps To Reproduce
  1. Import the atteched survey and run it with fruity -> all is fine
  2. Import the attached theme and assign it to the same survey.
  3. Run the survey -> broken
Additional Information

options.twig sample code:
................
{# Hide empty answers at print overview #}
<div class='col-sm-12 col-md-4'>
<div class='form-group row'>
<label for='simple_edit_options_hideempty' class='control-label'> {{ gT("Hide un-checked items at print overview") }} </label>
<div class='col-sm-12'>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default">
<input type='radio' name='hideempty' value='on' class='selector_option_radio_field simple_edit_options_hideempty ' data-id='hideempty'/>
{{ gT("Yes") }}
</label>
<label class="btn btn-default">
<input type='radio' name='hideempty' value='off' class='selector_option_radio_field simple_edit_options_hideempty ' data-id='hideempty'/>
{{ gT("No") }}
</label>
{# If this is a root template setting, don't show the inherit button #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-default">
<input type='radio' name='hideempty' value='inherit' class='selector_option_radio_field simple_edit_options_hideempty ' data-id='hideempty'/>
{{ gT("Inherit") }}
</label>
{% endif %}
</div>
</div>
</div>
</div>
..........

config.xml new setting:
....
<showpopups>1</showpopups>
<fixnumauto>off</fixnumauto>
<!-- 2020-06-26 Marcel Minke: New print option setting -->
<hideempty>on</hideempty>
</options>
<!-- Engine configuration is the very same as vanilla -->
</config>

Error message:
Recoverable error
Object of class stdClass could not be converted to string

/var/www/vhosts/my-survey.host/fma.my-survey.host/ls/application/core/LSETwigViewRenderer.php(512)

500 $showxquestions = Yii::app()->getConfig('showxquestions');
501 $aDatas["aSurveyInfo"]['bShowxquestions'] = ($showxquestions == 'show' || ($showxquestions == 'choose' && !isset($aDatas['aSurveyInfo']['showxquestions'])) || ($showxquestions == 'choose' && $aDatas['aSurveyInfo']['showxquestions'] == 'Y'));
502
503
504 // NB: Session is flushed at submit, so sid is not defined here.
505 if (isset($SESSION['survey'.$aDatas['aSurveyInfo']['sid']]) && isset($SESSION['survey'.$aDatas['aSurveyInfo']['sid']]['totalquestions'])) {
506 $aDatas["aSurveyInfo"]['iTotalquestions'] = $SESSION['survey'.$aDatas['aSurveyInfo']['sid']]['totalquestions'];
507 }
508
509 // Add the survey theme options
510 if ($oTemplate->oOptions) {
511 foreach ($oTemplate->oOptions as $key => $value) {
512 $aDatas["aSurveyInfo"]["options"][$key] = (string) $value;
513 }
514 }
515 } else {
516 // Add the global theme options
517 $oTemplateConfigurationCurrent = Template::getInstance($oTemplate->sTemplateName);
518 $aDatas["aSurveyInfo"]["options"] = isJson($oTemplateConfigurationCurrent['options'])?(array)json_decode($oTemplateConfigurationCurrent['options']):$oTemplateConfigurationCurrent['options'];
519 }
520
521 $aDatas = $this->fixDataCoherence($aDatas);
522
523 return $aDatas;
524 }

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)Version 4.3.0
I will donate to the project if issue is resolvedNo
BrowserChrome
Database type & versionMySQL 5
Server OS (if known)Ubuntu 18
Webserver software & version (if known)Apache
PHP Version7.3

Relationships

related to 16498 closed Can't run survey with child theme because of enheritance problems. 

Users monitoring this issue

There are no users monitoring this issue.

Activities

user225042

2020-07-21 16:42

  ~59019

I was not able to replicate this issue in the latest master Version(4.3.5).

gabrieljenik

gabrieljenik

2020-07-22 16:10

manager   ~59043

Although codebase is similar, I have found this line on master, which I guess it is not on LTS.
(see attachment)

It is on Master
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/models/TemplateConfiguration.php#L1259
but it was not on LTS
https://github.com/LimeSurvey/LimeSurvey/blob/3.x-LTS/application/models/TemplateConfiguration.php#L1095

That's why the issue happened on LTS but not on Master.

Should we apply the same changes we applied on LTS to master?

image.png (28,400 bytes)   
image.png (28,400 bytes)   
gabrieljenik

gabrieljenik

2020-07-30 00:35

manager   ~59189

Last edited: 2020-07-30 00:46

Although issue was not reproducible here, we port some of the fixes added on LTS
1- Removed xml comments after loading config.xml.
2 - Had empty nodes to be saved in DB as empty strings.

https://github.com/LimeSurvey/LimeSurvey/pull/1523

user225042

2020-08-04 17:34

  ~59297

Code is been reviewed by Jessica,  working fine

gabrieljenik

gabrieljenik

2020-08-10 15:49

manager   ~59388

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

lime_release_bot

lime_release_bot

2020-08-12 10:10

administrator   ~59427

Fixed in Release 4.3.10+200812

Related Changesets

LimeSurvey: master babbddb1

2020-08-10 15:36:03

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 16508: Can't run survey with child theme because of enheritance problems. (#1523)

1- Removed xml comments after loading config.xml.
2 - Had empty nodes to be saved in DB as empty strings.
Affected Issues
16508
mod - application/models/TemplateConfig.php Diff File
mod - application/models/TemplateManifest.php Diff File

Issue History

Date Modified Username Field Change
2020-07-21 00:10 gabrieljenik New Issue
2020-07-21 00:10 gabrieljenik Issue generated from: 16498
2020-07-21 00:10 gabrieljenik Relationship added related to 16498
2020-07-21 16:42 user225042 Note Added: 59019
2020-07-22 16:10 gabrieljenik Note Added: 59043
2020-07-22 16:10 gabrieljenik File Added: image.png
2020-07-30 00:35 gabrieljenik Note Added: 59189
2020-07-30 00:46 gabrieljenik Note Edited: 59189
2020-08-04 17:34 user225042 Note Added: 59297
2020-08-10 15:49 gabrieljenik Changeset attached => LimeSurvey master babbddb1
2020-08-10 15:49 gabrieljenik Note Added: 59388
2020-08-10 15:49 gabrieljenik Assigned To => gabrieljenik
2020-08-10 15:49 gabrieljenik Resolution open => fixed
2020-08-12 10:10 lime_release_bot Note Added: 59427
2020-08-12 10:10 lime_release_bot Status new => closed