View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
12795Bug reportsTheme editorpublic2017-10-25 11:18
Reportertammo Assigned Toollehar  
PrioritynoneSeverityblock 
Status closedResolutionfixed 
Product Version3.0.0-beta.x 
Fixed in Version3.0.0-rc.x 
Summary12795: Crash when using newly created template (template editor)
Description
  1. fresh installation with default survey (attached)
  2. define new template (NewTemplate)
  3. Activate NewTemplate on defaultsurvey
  4. Preview survey
  5. Observe crash

Different from crash at "copy_of_minimal"

Additional Information

PHP warning

Invalid argument supplied for foreach()

D:\dev\lsgit\application\models\TemplateConfiguration.php(629)

617 $this->oOptions = array();
618 if (!empty($this->options)){
619 $this->oOptions = json_decode($this->options);
620 }
621
622 $this->setOptionInheritance();
623 }
624
625 protected function setOptionInheritance()
626 {
627 $oOptions = $this->oOptions;
628
629 foreach($oOptions as $sKey => $sOption){
630 $oOptions->$sKey = $this->getOptionKey($sKey);
631 }
632 }
633
634 protected function getOptionKey($key){
635 $aOptions = (array) json_decode($this->options);
636 $value = $aOptions[$key];
637 if($value === 'inherit'){
638 return $this->getParentConfiguration()->getOptionKey($key);
639 }
640 return $value;
641 }
Stack Trace
#0
– D:\dev\lsgit\application\models\TemplateConfiguration.php(622): TemplateConfiguration->setOptionInheritance()
617 $this->oOptions = array();
618 if (!empty($this->options)){
619 $this->oOptions = json_decode($this->options);
620 }
621
622 $this->setOptionInheritance();
623 }
624
625 protected function setOptionInheritance()
626 {
627 $oOptions = $this->oOptions;
#1
– D:\dev\lsgit\application\models\TemplateConfiguration.php(587): TemplateConfiguration->setOptions()
582 $this->apiVersion = (!empty($this->template->api_version))? $this->template->api_version : $this->oMotherTemplate->apiVersion;
583 $this->viewPath = (!empty($this->template->view_folder)) ? $this->path.DIRECTORY_SEPARATOR.$this->template->view_folder.DIRECTORY_SEPARATOR : $this->path.DIRECTORY_SEPARATOR.$this->oMotherTemplate->view_folder.DIRECTORY_SEPARATOR;
584 $this->filesPath = (!empty($this->template->files_folder)) ? $this->path.DIRECTORY_SEPARATOR.$this->template->files_folder.DIRECTORY_SEPARATOR : $this->path.DIRECTORY_SEPARATOR.$this->oMotherTemplate->file_folder.DIRECTORY_SEPARATOR;
585
586 // Options are optional
587 $this->setOptions();
588
589 // Not mandatory (use package dependances)
590 $this->setCssFramework();
591 $this->packages = $this->getDependsPackages($this);
592 if (!empty($this->packages_to_load)){
#2
– D:\dev\lsgit\application\models\TemplateConfiguration.php(370): TemplateConfiguration->setThisTemplate()
365 public function prepareTemplateRendering($sTemplateName='', $iSurveyId='', $bUseMagicInherit=true)
366 {
367 $this->bUseMagicInherit = $bUseMagicInherit;
368 $this->setBasics($sTemplateName, $iSurveyId);
369 $this->setMotherTemplates(); // Recursive mother templates configuration
370 $this->setThisTemplate(); // Set the main config values of this template
371 $this->createTemplatePackage($this); // Create an asset package ready to be loaded
372 return $this;
373 }
374
375 public function setBasics($sTemplateName='', $iSurveyId='')
#3
– D:\dev\lsgit\application\models\Template.php(412): TemplateConfiguration->prepareTemplateRendering("", "674294")
407 }
408
409 if (empty(self::$instance)) {
410 // getTemplateConfiguration($sTemplateName=null, $iSurveyId=null, $iSurveyGroupId=null, $bForceXML=false)
411 self::$instance = $toto = self::getTemplateConfiguration($sTemplateName, $iSurveyId, $iSurveyGroupId, $bForceXML);
412 self::$instance->prepareTemplateRendering($sTemplateName, $iSurveyId);
413 }
414
415
416 return self::$instance;
417 }
#4
– D:\dev\lsgit\application\controllers\survey\index.php(281): Template::getInstance("", "674294")
276 unset($token);
277 unset($clienttoken);
278 }
279
280 //SET THE TEMPLATE DIRECTORY
281 $oTemplate = Template::model()->getInstance('', $surveyid);
282 $timeadjust = Yii::app()->getConfig("timeadjust");
283
284 //MAKE SURE SURVEY HASN'T EXPIRED
285 if ($thissurvey['expiry']!='' and dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust)>$thissurvey['expiry'] && $thissurvey['active']!='N' && !$previewmode){
286 $aErrors=array(gT('Error'));
#5
– D:\dev\lsgit\application\controllers\survey\index.php(21): index->action()
16 public $oTemplate;
17
18 public function run()
19 {
20 useFirebug();
21 $this->action();
22 }
23
24 function action()
25 {
26 global $surveyid;
#6
– D:\dev\lsgit\framework\web\actions\CAction.php(76): index->run()
71 {
72 $method=new ReflectionMethod($this, 'run');
73 if($method->getNumberOfParameters()>0)
74 return $this->runWithParamsInternal($this, $method, $params);
75
76 $this->run();
77 return true;
78 }
79
80 /*
81
Executes a method of an object with the supplied named parameters.
#7
– D:\dev\lsgit\framework\web\CController.php(308): CAction->runWithParams(array("lang" => "en", "sid" => "674294"))
303 {
304 $priorAction=$this->_action;
305 $this->_action=$action;
306 if($this->beforeAction($action))
307 {
308 if($action->runWithParams($this->getActionParams())===false)
309 $this->invalidActionParams($action);
310 else
311 $this->afterAction($action);
312 }
313 $this->_action=$priorAction;
#8
– D:\dev\lsgit\framework\web\CController.php(286): CController->runAction(index)
281 @see runAction
282
/
283 public function runActionWithFilters($action,$filters)
284 {
285 if(empty($filters))
286 $this->runAction($action);
287 else
288 {
289 $priorAction=$this->_action;
290 $this->_action=$action;
291 CFilterChain::create($this,$action,$filters)->run();
#9
– D:\dev\lsgit\framework\web\CController.php(265): CController->runActionWithFilters(index, array())
260 {
261 if(($parent=$this->getModule())===null)
262 $parent=Yii::app();
263 if($parent->beforeControllerAction($this,$action))
264 {
265 $this->runActionWithFilters($action,$this->filters());
266 $parent->afterControllerAction($this,$action);
267 }
268 }
269 else
270 $this->missingAction($actionID);
#10
– D:\dev\lsgit\framework\web\CWebApplication.php(282): CController->run("index")
277 {
278 list($controller,$actionID)=$ca;
279 $oldController=$this->_controller;
280 $this->_controller=$controller;
281 $controller->init();
282 $controller->run($actionID);
283 $this->_controller=$oldController;
284 }
285 else
286 throw new CHttpException(404,Yii::t('yii','Unable to resolve the request "{route}".',
287 array('{route}'=>$route===''?$this->defaultController:$route)));
#11
– D:\dev\lsgit\framework\web\CWebApplication.php(141): CWebApplication->runController("survey/index/sid/674294")
136 foreach(array_splice($this->catchAllRequest,1) as $name=>$value)
137 $_GET[$name]=$value;
138 }
139 else
140 $route=$this->getUrlManager()->parseUrl($this->getRequest());
141 $this->runController($route);
142 }
143
144 /
145 Registers the core application components.
146
This method overrides the parent implementation by registering additional core components.
#12
– D:\dev\lsgit\framework\base\CApplication.php(185): CWebApplication->processRequest()
180 public function run()
181 {
182 if($this->hasEventHandler('onBeginRequest'))
183 $this->onBeginRequest(new CEvent($this));
184 register_shutdown_function(array($this,'end'),0,false);
185 $this->processRequest();
186 if($this->hasEventHandler('onEndRequest'))
187 $this->onEndRequest(new CEvent($this));
188 }
189
190 /

#13
– D:\dev\lsgit\index.php(195): CApplication->run()
190 require_once APPPATH . 'core/LSYii_Application' . EXT;
191
192 $config = require_once(APPPATH . 'config/internal' . EXT);
193
194 Yii::$enableIncludePath = false;
195 Yii::createApplication('LSYii_Application', $config)->run();
196
197 / End of file index.php /
198 / Location: ./index.php /
2017-10-15 10:14:41 Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.5.30 Yii Framework/1.1.18

TagsNo tags attached.
Attached Files
defaultsurvey.lss (12,544 bytes)
Bug heat6
Complete LimeSurvey version number (& build)3,0 git
I will donate to the project if issue is resolvedNo
Browserchrome
Database type & versionnn
Server OS (if known)nn
Webserver software & version (if known)nn
PHP Version5.5.30

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2017-10-16 12:55

administrator   ~44690

Can I assume you're using the latest git develop on your bug reports?

ollehar

ollehar

2017-10-16 12:55

administrator   ~44691

Wait, nevermind, it's in the report.

tammo

tammo

2017-10-16 13:06

developer   ~44692

;-)

ollehar

ollehar

2017-10-16 17:11

administrator   ~44694

"Fixed", but seems like the options are not copied to the new template. What I did:

  1. Import your survey
  2. Copy default to copy_of_default
  3. Use copy_of_default in survey
  4. Execute preview
  5. Works, but no fancy sliding or background.

Feel free to pull and test.

tammo

tammo

2017-10-17 09:20

developer   ~44698

Olle, this issue was not about a copied template, but about a newly created template (using the button "create"). There was also an issue about a copied template, which also led to an error message, but another error message.

tammo

tammo

2017-10-17 09:41

developer   ~44701

This one

LimeGit (10).png (17,974 bytes)   
LimeGit (10).png (17,974 bytes)   
tammo

tammo

2017-10-17 09:42

developer   ~44702

Wondering what it creates. On what is it based, because when you create a new template a template.css is also defined. Where does that come from?

Maybe @LouisGac knows...

LouisGac

LouisGac

2017-10-17 10:38

developer   ~44704

yes I'll do that today

tammo

tammo

2017-10-19 11:26

developer   ~44732

Checked. OK now

Issue History

Date Modified Username Field Change
2017-10-15 10:18 tammo New Issue
2017-10-15 10:18 tammo Status new => assigned
2017-10-15 10:18 tammo Assigned To => ollehar
2017-10-15 10:18 tammo File Added: defaultsurvey.lss
2017-10-16 12:55 ollehar Note Added: 44690
2017-10-16 12:55 ollehar Note Added: 44691
2017-10-16 13:06 tammo Note Added: 44692
2017-10-16 17:11 ollehar Note Added: 44694
2017-10-17 09:20 tammo Note Added: 44698
2017-10-17 09:41 tammo File Added: LimeGit (10).png
2017-10-17 09:41 tammo Note Added: 44701
2017-10-17 09:42 tammo Note Added: 44702
2017-10-17 10:38 LouisGac Note Added: 44704
2017-10-19 11:26 tammo Status assigned => resolved
2017-10-19 11:26 tammo Resolution open => fixed
2017-10-19 11:26 tammo Note Added: 44732
2017-10-25 11:16 c_schmitz Fixed in Version => 3.0.0-rc.x
2017-10-25 11:18 c_schmitz Status resolved => closed