View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
09158Bug reportsStatisticspublic2014-09-09 01:06
ReporterScottIon Assigned Toc_schmitz  
PrioritynormalSeverityblock 
Status closedResolutionunable to reproduce 
Product Version2.05+ 
Summary09158: code crashes when trying to generate zip file of uploaded files
Description

When in the Browse Responses screen, viewing the list of survey responses, I tried to download a zip file of all the uploaded files.

With debug mode off, there was no effect (screen refreshed, but no file download happened). Turning debug mode on resulted in a CDbException (see add'l info below).

Steps To Reproduce
  • change config.php debug level to '2'
  • import attached .lss file
  • execute survey as an end user would - upload several files (test with spaces in file name, other non-alpha characters, etc)
  • go into admin back end
  • go into responses/stats
  • click on submissions list
  • click on 'download zip file of attachments'
Additional Information

CDbException

Column name must be either a string or an array.

\TDSBWWWDATA\WWWTST$\LimeSurvey\www\framework\db\schema\CDbCommandBuilder.php(828)

816 }
817 if(count($values)===1)
818 {
819 $entries=array();
820 foreach($values[0] as $name=>$value)
821 $entries[]=$prefix.$table->columns[$name]->rawName.($value===null?' IS NULL':'='.$value);
822 return implode(' AND ',$entries);
823 }
824
825 return $this->createCompositeInCondition($table,$values,$prefix);
826 }
827 else
828 throw new CDbException(Yii::t('yii','Column name must be either a string or an array.'));
829 }
830
831 /*
832
Generates the expression for selecting rows with specified composite key values.
833 @param CDbTableSchema $table the table schema
834
@param array $values list of primary key values to be selected within
835 @param string $prefix column prefix (ended with dot)
836
@return string the expression for selection
837 */
838 protected function createCompositeInCondition($table,$values,$prefix)
839 {
840 $keyNames=array();

Stack Trace

#0 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\framework\db\schema\CDbCommandBuilder.php(621): CDbCommandBuilder->createInCondition(CMssqlTableSchema, null, array("4"), "[t].")
616 $prefix=$this->_schema->quoteTableName($criteria->alias).'.';
617 if(!is_array($pk)) // single key
618 $pk=array($pk);
619 if(is_array($table->primaryKey) && !isset($pk[0]) && $pk!==array()) // single composite key
620 $pk=array($pk);
621 $condition=$this->createInCondition($table,$table->primaryKey,$pk,$prefix);
622 if($criteria->condition!='')
623 $criteria->condition=$condition.' AND ('.$criteria->condition.')';
624 else
625 $criteria->condition=$condition;
626

#1 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\framework\db\ar\CActiveRecord.php(1501): CDbCommandBuilder->createPkCriteria(CMssqlTableSchema, "4", "", array(), ...)
1496 */
1497 public function findAllByPk($pk,$condition='',$params=array())
1498 {
1499 Yii::trace(get_class($this).'.findAllByPk()','system.db.ar.CActiveRecord');
1500 $prefix=$this->getTableAlias(true).'.';
1501 $criteria=$this->getCommandBuilder()->createPkCriteria($this->getTableSchema(),$pk,$condition,$params,$prefix);
1502 return $this->query($criteria,true);
1503 }
1504
1505 /*
1506
Finds a single active record that has the specified attribute values.

#2 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\application\controllers\admin\responses.php(803): CActiveRecord->findAllByPk("4")
798 Yii::app()->loadLibrary('admin/pclzip');
799
800 $tmpdir = Yii::app()->getConfig('uploaddir') . DIRECTORY_SEPARATOR."surveys". DIRECTORY_SEPARATOR . $iSurveyID . DIRECTORY_SEPARATOR."files".DIRECTORY_SEPARATOR;
801
802 $filelist = array();
803 $responses = Response::model($iSurveyID)->findAllByPk($responseIds);
804 $filecount = 0;
805 foreach ($responses as $response)
806 {
807 foreach ($response->getFiles() as $file)
808 {

#3 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\application\controllers\admin\responses.php(389): responses->_zipFiles("463464", "4", "Files_for_responses_4.zip")
384 {
385 if(Permission::model()->hasSurveyPermission($iSurveyID,'responses','read'))
386 {
387 // Now, zip all the files in the filelist
388 $zipfilename = "Files_forresponses" . Yii::app()->request->getPost('downloadfile') . ".zip";
389 $this->_zipFiles($iSurveyID, Yii::app()->request->getPost('downloadfile'), $zipfilename);
390 }
391 }
392 elseif (Yii::app()->request->getParam('downloadindividualfile') != '')
393 {
394 if(Permission::model()->hasSurveyPermission($iSurveyID,'responses','read'))

#4 unknown(0): responses->browse("463464")

#5 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\framework\web\actions\CAction.php(108): ReflectionMethod->invokeArgs(responses, array("463464"))
103 elseif($param->isDefaultValueAvailable())
104 $ps[]=$param->getDefaultValue();
105 else
106 return false;
107 }
108 $method->invokeArgs($object,$ps);
109 return true;
110 }
111 }

#6 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\application\core\Survey_Common_Action.php(99): CAction->runWithParamsInternal(responses, ReflectionMethod, array("r" => "admin/responses/sa/browse/surveyid/463464", "sa" => "browse", "surveyid" => "463464", "iSurveyId" => "463464", ...))
094 $oMethod = new ReflectionMethod($this, $sDefault);
095 }
096
097 // We're all good to go, let's execute it
098 // runWithParamsInternal would automatically get the parameters of the method and populate them as required with the params
099 return parent::runWithParamsInternal($this, $oMethod, $params);
100 }
101
102 /*
103
Some functions have different parameters, which are just an alias of the
104 * usual parameters we're getting in the url. This function just populates

#7 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\framework\web\CController.php(308): Survey_Common_Action->runWithParams(array("r" => "admin/responses/sa/browse/surveyid/463464", "sa" => "browse", "surveyid" => "463464"))
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 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\framework\web\CController.php(286): CController->runAction(responses)
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 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\framework\web\CController.php(265): CController->runActionWithFilters(responses, 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 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\application\controllers\AdminController.php(169): CController->run("responses")
164 $this->redirect(array('/admin/authentication/sa/login'));
165 }
166
167 }
168
169 return parent::run($action);
170 }
171
172 /*
173
Routes all the actions to their respective places
174 *

#11 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\framework\web\CWebApplication.php(282): AdminController->run("responses")
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)));

#12 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\framework\web\CWebApplication.php(141): CWebApplication->runController("admin/responses/sa/browse/surveyid/463464")
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.

#13 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\framework\base\CApplication.php(180): CWebApplication->processRequest()
175 public function run()
176 {
177 if($this->hasEventHandler('onBeginRequest'))
178 $this->onBeginRequest(new CEvent($this));
179 register_shutdown_function(array($this,'end'),0,false);
180 $this->processRequest();
181 if($this->hasEventHandler('onEndRequest'))
182 $this->onEndRequest(new CEvent($this));
183 }
184
185 /**

#14 – \TDSBWWWDATA\WWWTST$\LimeSurvey\www\index.php(200): CApplication->run()
195 die (sprintf('%s should be writable by the webserver (755 or 775).', $runtimePath));
196 }
197 }
198
199
200 Yii::createApplication('LSYii_Application', $config)->run();
201
202 / End of file index.php /
203 / Location: ./index.php /

2014-08-05 20:34:15 Microsoft-IIS/7.5 Yii Framework/1.1.14

TagsNo tags attached.
Attached Files
Bug heat4
Complete LimeSurvey version number (& build)Version 2.05+ Build 140717
I will donate to the project if issue is resolvedNo
BrowserIE 11
Database type & versionMS SQL 2012
Server OS (if known)Windows 2008 R2
Webserver software & version (if known)IIS
PHP Version5.4.17

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2014-08-08 12:56

administrator   ~30402

No problems here - did you clean your browser cache after updating to the latest version? If not please try that first.

ScottIon

ScottIon

2014-08-15 15:19

reporter   ~30423

Yes - cleared the browser cache, and tried with multiple browsers (Firefox / Chrome). When we did the upgrade to the latest version, we also recycled the application pool.

I'm also running into another issue now (since we upgraded to the latest version) - when I try to go in as a regular user to complete the survey, the 'Upload Files' window is not working. It allows me to select a file, but then does not display it in the window once selected, and doesn't store any info.

Could all of this be related to folder permissions (or DB permissions)? We're running this on a Windows box w. SQL server. File permissions are set to read-only for everything except for full permissions on the /tmp folder (and all sub-folders).

Are you testing on a linux/unix box or on Windows?

c_schmitz

c_schmitz

2014-09-09 01:06

administrator   ~30508

Ehm, write permission needs to be set for the /upload folder (and any subfolders), too.

Issue History

Date Modified Username Field Change
2014-08-05 22:52 ScottIon New Issue
2014-08-05 22:52 ScottIon File Added: limesurvey_survey_463464.lss
2014-08-06 16:08 c_schmitz Assigned To => c_schmitz
2014-08-06 16:08 c_schmitz Status new => assigned
2014-08-08 12:56 c_schmitz Note Added: 30402
2014-08-08 12:56 c_schmitz Status assigned => feedback
2014-08-15 15:19 ScottIon Note Added: 30423
2014-08-15 15:19 ScottIon Status feedback => assigned
2014-09-09 01:06 c_schmitz Note Added: 30508
2014-09-09 01:06 c_schmitz Status assigned => closed
2014-09-09 01:06 c_schmitz Resolution open => unable to reproduce