View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
12789Bug reportsTheme editorpublic2017-10-25 11:18
Reportertammo Assigned Toollehar  
PrioritynoneSeveritycrash 
Status closedResolutionfixed 
Product Version3.0.0-beta.x 
Fixed in Version3.0.0-rc.x 
Summary12789: Copy template.css to copy_of_minimal crashes
Description

In template editor:
copy minimal template to 1310minimal

then copy template.css to local version of template (so it is not inherited anymore)
results in:

PHP notice

Undefined variable: changedtext

D:\dev\lsgit\application\controllers\admin\templates.php(598)

586 $action = returnGlobal('action');
587 $editfile = returnGlobal('editfile');
588 $relativePathEditfile = returnGlobal('relativePathEditfile');
589 $sTemplateName = Template::templateNameFilter(App()->request->getPost('templatename'));
590 $screenname = returnGlobal('screenname');
591 $oEditedTemplate = Template::model()->getTemplateConfiguration($sTemplateName, null,null, true);
592 $oEditedTemplate->prepareTemplateRendering($sTemplateName);
593 $aScreenFiles = $oEditedTemplate->getValidScreenFiles("view");
594 $cssfiles = $oEditedTemplate->getValidScreenFiles("css");
595 $jsfiles = $oEditedTemplate->getValidScreenFiles("js");
596
597
598 if ($action == "templatesavechanges" && $changedtext){
599 Yii::app()->loadHelper('admin/template');
600 $changedtext = str_replace("\r\n", "\n", $changedtext);
601
602
603 if ($relativePathEditfile){
604 // Check if someone tries to submit a file other than one of the allowed filenames
605 if (
606 in_array($relativePathEditfile,$aScreenFiles)===false &&
607 in_array($relativePathEditfile,$cssfiles)===false &&
608 in_array($relativePathEditfile,$jsfiles)===false
609 ){
610 Yii::app()->user->setFlash('error',gT('Invalid template name'));
Stack Trace
#0
unknown(0): templates->templatesavechanges()
#1
– D:\dev\lsgit\framework\web\actions\CAction.php(109): ReflectionMethod->invokeArgs(templates, array())
104 elseif($param->isDefaultValueAvailable())
105 $ps[]=$param->getDefaultValue();
106 else
107 return false;
108 }
109 $method->invokeArgs($object,$ps);
110 return true;
111 }
112 }
#2
– D:\dev\lsgit\application\core\Survey_Common_Action.php(87): CAction->runWithParamsInternal(templates, ReflectionMethod, array("sa" => "templatesavechanges"))
82 $oMethod = new ReflectionMethod($this, $sDefault);
83 }
84
85 // We're all good to go, let's execute it
86 // runWithParamsInternal would automatically get the parameters of the method and populate them as required with the params
87 return parent::runWithParamsInternal($this, $oMethod, $params);
88 }
89
90 /
91 Some functions have different parameters, which are just an alias of the
92
usual parameters we're getting in the url. This function just populates
#3
– D:\dev\lsgit\application\controllers\admin\templates.php(33): Survey_Common_Action->runWithParams(array("sa" => "templatesavechanges"))
28 {
29 if (!Permission::model()->hasGlobalPermission('templates','read')){
30 die('No permission');
31 }
32
33 parent::runWithParams($params);
34 }
35
36 /

37 Exports a template
38

#4
– D:\dev\lsgit\framework\web\CController.php(308): templates->runWithParams(array("sa" => "templatesavechanges"))
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;
#5
– D:\dev\lsgit\framework\web\CController.php(286): CController->runAction(templates)
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();
#6
– D:\dev\lsgit\framework\web\CController.php(265): CController->runActionWithFilters(templates, 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);
#7
– D:\dev\lsgit\application\controllers\AdminController.php(179): CController->run("templates")
174 $this->redirect(array('/admin/authentication/sa/login'));
175 }
176 }
177 }
178
179 return parent::run($action);
180 }
181
182 /
183 Routes all the actions to their respective places
184

#8
– D:\dev\lsgit\framework\web\CWebApplication.php(282): AdminController->run("templates")
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)));
#9
– D:\dev\lsgit\framework\web\CWebApplication.php(141): CWebApplication->runController("admin/templates/sa/templatesavechanges")
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.
#10
– 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 /*
#11
– 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-13 15:33:59 Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.5.30 Yii Framework/1.1.18

TagsNo tags attached.
Attached Files
Bug heat2
Complete LimeSurvey version number (& build)3.0 git
I will donate to the project if issue is resolvedNo
Browserchrome
Database type & versionnr
Server OS (if known)nr
Webserver software & version (if known)nr
PHP Versionnr

Users monitoring this issue

There are no users monitoring this issue.

Activities

tammo

tammo

2017-10-13 15:57

developer   ~44678

Look at position of slashes. Not sure it this works OK.

LimeGit (1).png (16,652 bytes)   
LimeGit (1).png (16,652 bytes)   
tammo

tammo

2017-10-13 16:04

developer   ~44680

Same slashes on template.js (but no crash)

LimeGit (2).png (9,146 bytes)   
LimeGit (2).png (9,146 bytes)   
tammo

tammo

2017-10-13 16:05

developer   ~44681

Slashes ok on layout.twig

LimeGit (4).png (66,878 bytes)   
LimeGit (4).png (66,878 bytes)   
tammo

tammo

2017-10-19 11:27

developer   ~44735

Checked. OK now

Issue History

Date Modified Username Field Change
2017-10-13 15:37 tammo New Issue
2017-10-13 15:37 tammo Status new => assigned
2017-10-13 15:37 tammo Assigned To => ollehar
2017-10-13 15:57 tammo File Added: LimeGit (1).png
2017-10-13 15:57 tammo Note Added: 44678
2017-10-13 16:04 tammo File Added: LimeGit (2).png
2017-10-13 16:04 tammo Note Added: 44680
2017-10-13 16:05 tammo File Added: LimeGit (4).png
2017-10-13 16:05 tammo Note Added: 44681
2017-10-19 11:27 tammo Status assigned => resolved
2017-10-19 11:27 tammo Resolution open => fixed
2017-10-19 11:27 tammo Note Added: 44735
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