View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
16498Bug reportsTheme editorpublic2020-07-30 15:11
ReporterMazi Assigned To 
PrioritynoneSeveritycrash 
Status closedResolutionfixed 
Product Version3.22.26 
Summary16498: Can't run survey with child theme because of enheritance problems.
Description

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 heat10
Complete LimeSurvey version number (& build)Version 3.22.26+200714
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 16508 closedgabrieljenik Can't run survey with child theme because of enheritance problems. 

Users monitoring this issue

There are no users monitoring this issue.

Activities

Mazi

Mazi

2020-07-15 15:43

updater   ~58956

Added theme and sample survey.

fma_fruity.zip (169,240 bytes)
Mazi

Mazi

2020-07-15 15:43

updater   ~58957

Last edited: 2020-07-29 16:18

@gabrieljenik, this is the issue we talked about.

gabrieljenik

gabrieljenik

2020-07-15 20:23

manager   ~58962

Last edited: 2020-07-29 16:18

From what we saw the problem comes with comments in the config.xml, in the options area.
When the config.xml is initially parsed, the comments are also parsed and tured into nodes, empty nodes.
These empty nodes are not saved in the DB as NULL or an empty string, but more as an empty standard object {}

When these empty objects are parsed through the PHP code, it expects scalar type but finds object, which can't be converted to string.
Then it fails.

When using the survey options (no inheritance), the options saved on the DB come from the twig, so no empty nodes are saved.
That's why it works with "no inheritance".

Suggested steps for solution:
1- Remove comments after loading config.xml.
2 - Have empty nodes to be saved in DB as empty strings.
We would add an optioal argument for that so it can be done for the options.
Still expandable to all toher xml sections.

Comments?

DenisChenu

DenisChenu

2020-07-16 09:36

developer   ~58967

Last edited: 2020-07-29 16:18

I already see issue with XML comments set as null nod in DB.
I remove comments … on SkelVanilla …

1+2 seems great :) We have an issue about empty node in QuestinTheme &lt;default>&lt;default> save as {} not as '' (reported by Tony somewhere)

gabrieljenik

gabrieljenik

2020-07-21 00:15

manager   ~59005

Last edited: 2020-07-29 16:18

PR: https://github.com/LimeSurvey/LimeSurvey/pull/1492

user225042

2020-07-21 17:32

  ~59022

Last edited: 2020-07-29 16:18

Tested the issue by pulling the PR but I can still see the issue. @gabrieljenik can confirm on this ?

user225042

2020-07-21 17:42

  ~59024

Last edited: 2020-07-29 16:18

Please refer the attachment for more details

DenisChenu

DenisChenu

2020-07-21 17:47

developer   ~59025

Last edited: 2020-07-29 16:18

My opinion : current pull request didn't fix already broken DB, only new copy

Must reset theme ?

user225042

2020-07-22 16:29

  ~59045

Last edited: 2020-07-29 16:18

Tested the issue before pulling the PR, Issue exist. Tested the issue after pulling the PR, working as expected. Please refer the attachment for more details

Tested also by enabling debug mode

gabrieljenik

gabrieljenik

2020-07-23 18:58

manager   ~59064

Last edited: 2020-07-29 16:18

Fix committed to 3.x-LTS branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=30305

lime_release_bot

lime_release_bot

2020-07-27 10:53

administrator   ~59095

Last edited: 2020-07-29 16:18

Fixed in Release 3.22.28+200728

lime_release_bot

lime_release_bot

2020-07-30 15:11

administrator   ~59205

Fixed in Release 3.22.28+200728

Related Changesets

LimeSurvey: 3.x-LTS 00f6b275

2020-07-21 00:14:11

gabrieljenik

Details Diff
Fixed issue 16498: Can't run survey with child theme because of enheritance problems.

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

LimeSurvey: 3.x-LTS bfb947aa

2020-07-23 18:57:54

LimeBot


Committer: GitHub Details Diff
Merge pull request #1492 from gabrieljenik/bug/16498-Cant-run-survey-with-child-theme-because-of-enheritance-problems

Fixed issue 16498: Can't run survey with child theme because of enheritance problems.
Affected Issues
16498
mod - application/models/TemplateConfig.php Diff File
mod - application/models/TemplateManifest.php Diff File

Issue History

Date Modified Username Field Change
2020-07-15 15:41 Mazi New Issue
2020-07-15 15:43 Mazi Note Added: 58956
2020-07-15 15:43 Mazi File Added: limesurvey_survey_671144.lss
2020-07-15 15:43 Mazi File Added: fma_fruity.zip
2020-07-15 15:43 Mazi Note Added: 58957
2020-07-15 20:23 gabrieljenik Note Added: 58962
2020-07-16 09:36 DenisChenu Note Added: 58967
2020-07-21 00:10 gabrieljenik Issue cloned: 16508
2020-07-21 00:10 gabrieljenik Relationship added related to 16508
2020-07-21 00:15 gabrieljenik Note Added: 59005
2020-07-21 17:32 user225042 Note Added: 59022
2020-07-21 17:42 user225042 Note Added: 59024
2020-07-21 17:42 user225042 File Added: 16498_ChildTheme_Enheritance issue.png
2020-07-21 17:47 DenisChenu Note Added: 59025
2020-07-22 16:29 user225042 Note Added: 59045
2020-07-22 16:29 user225042 File Added: 16498_ChildTheme_Enheritance.png
2020-07-22 17:27 user225042 Status new => confirmed
2020-07-22 17:27 user225042 Zoho Sprints => |Yes|
2020-07-22 17:27 swendrich Zoho Sprints ID => 14469000000188025
2020-07-23 18:58 LimeBot Changeset attached => LimeSurvey 3.x-LTS bfb947aa
2020-07-23 18:58 gabrieljenik Changeset attached => LimeSurvey 3.x-LTS 00f6b275
2020-07-23 18:58 gabrieljenik Note Added: 59064
2020-07-27 10:53 lime_release_bot Zoho Sprints Yes => |Yes|
2020-07-27 10:53 lime_release_bot Note Added: 59095
2020-07-27 10:53 lime_release_bot Status confirmed => closed
2020-07-27 10:53 lime_release_bot Resolution open => fixed
2020-07-29 16:18 swendrich Zoho Sprints Yes => |Yes|
2020-07-29 16:18 swendrich Status closed => resolved
2020-07-30 15:11 lime_release_bot Zoho Sprints Yes => |Yes|
2020-07-30 15:11 lime_release_bot Note Added: 59205
2020-07-30 15:11 lime_release_bot Status resolved => closed