View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
17030Bug reportsSurvey editingpublic2021-02-09 12:09
Reporteraschwey Assigned Togabrieljenik  
PrioritynormalSeverityblock 
Status closedResolutionfixed 
Product Version4.4.0 
Summary17030: Can't add a question to a group
Description

I made a manual update from Version 4.3.34+210119 to Version 4.4.0+210129. Since then when I create a new survey I'm not able to add a question to the group. I get this error :
500: Internal Server Error
syntax error, unexpected '='

Steps To Reproduce

Create a new survey -> OK
Create the first group -> OK
Create the first Question - NOK

TagsNo tags attached.
Attached Files
Bug heat10
Complete LimeSurvey version number (& build)Version 4.4.0+210129
I will donate to the project if issue is resolvedNo
BrowserMicrosoft Edge Version 87.0.664.75 (Version officielle) (64 bits)
Database type & versionVersion du serveur : 10.2.32-MariaDB-log - SUSE package
Server OS (if known)SUSE Linux Enterprise Server 12 SP5 / Kernel: 4.12.14-122.41-default
Webserver software & version (if known)Server version: Apache/2.4.23 (Linux/SUSE)
PHP Version 7.0.7

Users monitoring this issue

There are no users monitoring this issue.

Activities

cdorin

cdorin

2021-01-29 17:18

reporter   ~61806

Hey, and thanks for report.

Can you please tell us how you try to create the question?

There are four ways:
1) Structure -> Add question
2) Click on group -> Add question (quick action button)
3) List questions (left side bar) -> Add question
4) List groups (left side bar) -> Add question from the action column (on the same line with the name of the group)

aschwey

aschwey

2021-01-29 17:36

reporter   ~61808

Last edited: 2021-01-30 17:34

Hello cdorin,

Sure I used option : 2) (as on the joined screenshot) Click on group -> Add question (quick action button) -> I get the 500: Internal Server Error syntax error, unexpected '='
But:
When I use option : 1) Structure -> Add question -> the browser tab stuck.
When I use option : 3) List questions (left side bar) -> Add question -> the browser tab stuck.
When I use option : 4) -> I get the 500: Internal Server Error syntax error, unexpected '='

cdorin

cdorin

2021-01-29 17:44

reporter   ~61809

Last edited: 2021-01-30 17:34

Can you enable debug mode ( debug=2) from config.php ?

aschwey

aschwey

2021-01-29 18:15

reporter   ~61810

Last edited: 2021-01-30 17:34

Ok I set the debug mode as requested:

    // debug: Set this to 1 if you are looking for errors. If you still get no errors after enabling this
    // then please check your error-logs - either in your hosting provider admin panel or in some /logs directory
    // on your webspace.
    // LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates
            'debug'=>2,
            'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2
            // Mysql database engine (INNODB|MYISAM):
aschwey

aschwey

2021-01-29 18:35

reporter   ~61811

Last edited: 2021-01-30 17:34

Hello cdorin,
I used option 2 and got :

ParseError
syntax error, unexpected '='

/srv/www/htdocs/limesurvey4/application/controllers/QuestionAdministrationController.php(769)

757
758 // TODO: Fix question type 'A'. Needed?
759 $oQuestion = $this->getQuestionObject($qid, 'A', $gid);
760 $oSubquestion = $oQuestion->getEmptySubquestion();
761 $oSubquestion->qid = $qid; // Set qid as new12345 random id.
762
763 //Capture "true" and "false" as strings
764 if (is_string($first)) {
765 $first = $first == "false" ? false : true;
766 }
767
768 $stringCodes = json_decode($codes, true);
769 [$oSubquestion->title, $newPosition] = $this->calculateNextCode($stringCodes);
770
771 $activated = false; // You can't add ne subquestion when survey is active
772 Yii::app()->loadHelper('admin/htmleditor'); // Prepare the editor helper for the view
773
774 $view = 'subquestionRow.twig';
775 $aData = array(
776 'position' => $position,
777 'scale_id' => $scale_id,
778 'activated' => $activated,
779 'first' => $first,
780 'surveyid' => $surveyid,
781 'gid' => $gid,
Stack Trace

#0
– /srv/www/htdocs/limesurvey4/framework/web/CWebApplication.php(276): CWebApplication->createController("view/")
271 @param string $route the route of the current request. See {@link createController} for more details.
272
@throws CHttpException if the controller could not be created.
273 */
274 public function runController($route)
275 {
276 if(($ca=$this->createController($route))!==null)
277 {
278 list($controller,$actionID)=$ca;
279 $oldController=$this->_controller;
280 $this->_controller=$controller;
281 $controller->init();

#1
– /srv/www/htdocs/limesurvey4/framework/web/CWebApplication.php(141): CWebApplication->runController("questionAdministration/view")
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.

#2
– /srv/www/htdocs/limesurvey4/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 /**

#3
– /srv/www/htdocs/limesurvey4/index.php(182): CApplication->run()
177 require_once APPPATH . 'core/LSYii_Application' . EXT;
178
179 $config = require_once(APPPATH . 'config/internal' . EXT);
180
181 Yii::$enableIncludePath = false;
182 Yii::createApplication('LSYii_Application', $config)->run();
183
184 / End of file index.php /
185 / Location: ./index.php /

2021-01-29 18:29:28 Apache Yii Framework/1.1.22-dev

DenisChenu

DenisChenu

2021-01-30 09:34

developer   ~61812

Last edited: 2021-01-30 17:34

769 [$oSubquestion->title, $newPosition] = $this->calculateNextCode($stringCodes);

PHP 7.0 compatibiity ?

aschwey

aschwey

2021-01-30 12:20

reporter   ~61818

Last edited: 2021-01-30 17:34

Sorry Denis,

I don't understand what you mean ?
Our php version is 7.0.7

The minimum set of requirements is
https://manual.limesurvey.org/Installation_-_LimeSurvey_CE#General:
Minimum 250 MB disk space.
MySQL 5.5.3 or later OR Microsoft SQL Server 2005 or later OR Postgres 9 or later.
Minimum PHP 7.0 or later; however, we recommend PHP 7.4 with the following modules/libraries enabled

DenisChenu

DenisChenu

2021-01-30 14:56

developer   ~61819

Last edited: 2021-01-30 17:34

It's a dev note : maybe it's a PHP 7 compat issue. And we must fix it in core :)

cdorin

cdorin

2021-01-30 17:34

reporter   ~61821

Last edited: 2021-01-30 17:34

Yes, I can reproduce it with php 7.0 . Thanks, @DenisChenu

gabrieljenik

gabrieljenik

2021-02-04 16:12

manager   ~61950

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

aschwey

aschwey

2021-02-04 16:56

reporter   ~61951

Hello gabrieljenik,

Thanks for your support. I changed the 2 lines . I can use 1) Structure -> Add question, but unfortunately when I save the question i got this first error but the question is saved :

PHP notice
Undefined index: script

/srv/www/htdocs/limesurvey4/application/controllers/QuestionAdministrationController.php(2489)

2477 */
2478 private function applyL10n($oQuestion, $dataSet)
2479 {
2480 foreach ($dataSet as $sLanguage => $aI10NBlock) {
2481 $i10N = QuestionL10n::model()->findByAttributes(['qid' => $oQuestion->qid, 'language' => $sLanguage]);
2482 if (empty($i10N)) {
2483 throw new Exception('Found no L10n object');
2484 }
2485 $i10N->setAttributes(
2486 [
2487 'question' => $aI10NBlock['question'],
2488 'help' => $aI10NBlock['help'],
2489 'script' => $aI10NBlock['script'],
2490 ],
2491 false
2492 );
2493 if (!$i10N->save()) {
2494 throw new CHttpException(500, gT("Could not store translation"));
2495 }
2496 }
2497
2498 return true;
2499 }
2500
2501 /**

Stack Trace
#0
– /srv/www/htdocs/limesurvey4/application/controllers/QuestionAdministrationController.php(398): QuestionAdministrationController->applyL10n(Question, array("en" => array("question" => "", "help" => "")))
393 }
394
395 // Apply the changes to general settings, advanced settings and translations
396 $setApplied = [];
397
398 $setApplied['questionI10N'] = $this->applyL10n($question, $questionData['questionI10N']);
399
400 $setApplied['advancedSettings'] = $this->unparseAndSetAdvancedOptions(
401 $question,
402 $questionData['advancedSettings']
403 );
#1

  • /srv/www/htdocs/limesurvey4/framework/web/actions/CInlineAction.php(49): QuestionAdministrationController->actionSaveQuestionData()
    #2
  • /srv/www/htdocs/limesurvey4/framework/web/CController.php(308): CInlineAction->runWithParams(array())
    #3
  • /srv/www/htdocs/limesurvey4/framework/web/CController.php(286): CController->runAction(CInlineAction)
    #4
  • /srv/www/htdocs/limesurvey4/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array())
    #5
    – /srv/www/htdocs/limesurvey4/application/controllers/LSBaseController.php(160): CController->run("saveQuestionData")
    155 $this->redirect(array('/admin/authentication/sa/login'));
    156 }
    157 }
    158 }
    159
    160 parent::run($action);
    161 }
    162
    163 /*
    164
    Load and set session vars
    165 *
    #6
  • /srv/www/htdocs/limesurvey4/framework/web/CWebApplication.php(282): LSBaseController->run("saveQuestionData")
    #7
  • /srv/www/htdocs/limesurvey4/framework/web/CWebApplication.php(141): CWebApplication->runController("questionAdministration/saveQuestionData")
    #8
  • /srv/www/htdocs/limesurvey4/framework/base/CApplication.php(185): CWebApplication->processRequest()
    #9
    – /srv/www/htdocs/limesurvey4/index.php(182): CApplication->run()
    177 require_once APPPATH . 'core/LSYii_Application' . EXT;
    178
    179 $config = require_once(APPPATH . 'config/internal' . EXT);
    180
    181 Yii::$enableIncludePath = false;
    182 Yii::createApplication('LSYii_Application', $config)->run();
    183
    184 / End of file index.php /
    185 / Location: ./index.php /

I'm able to edit the saved question but when I try to save it again I have a time out (please see sceenshot below)

When I use 2) Click on group -> Add question (quick action button) i got this :
CHttpException
Invalid question id

/srv/www/htdocs/limesurvey4/application/controllers/QuestionAdministrationController.php(125)

113 @param int $questionId
114
@param string $tabOverviewEditor which tab should be used this can be 'overview' or 'editor'
115 @return void
116
@throws CHttpException
117 */
118 public function actionEdit($questionId, $tabOverviewEditor = 'overview')
119 {
120 $questionId = (int) $questionId;
121
122 /* @var Question|null /
123 $question = Question::model()->findByPk($questionId);
124 if (empty($question)) {
125 throw new CHttpException(404, gT("Invalid question id"));
126 }
127
128 if (!Permission::model()->hasSurveyPermission($question->sid, 'surveycontent', 'update')) {
129 Yii::app()->user->setFlash('error', gT("Access denied"));
130 $this->redirect(Yii::app()->request->urlReferrer);
131 }
132
133 // "Directly show edit mode" personal setting
134 $tabOverviewEditor = SettingsUser::getUserSettingValue('noViewMode', App()->user->id) ? 'editor' : $tabOverviewEditor;
135
136 $this->aData['closeUrl'] = Yii::app()->createUrl(
137 'questionAdministration/view/',

Stack Trace
#0
– /srv/www/htdocs/limesurvey4/application/controllers/QuestionAdministrationController.php(68): QuestionAdministrationController->actionEdit(0)
63
64
@throws CException
65 */
66 public function actionView($surveyid, $gid = null, $qid = null, $landOnSideMenuTab = 'structure')
67 {
68 $this->actionEdit($qid);
69 }
70
71 /*
72
Show form to create new question.
73 *
#1
unknown(0): QuestionAdministrationController->actionView("452199", "10", null, "structure")
#2

  • /srv/www/htdocs/limesurvey4/framework/web/actions/CAction.php(109): ReflectionMethod->invokeArgs(QuestionAdministrationController, array("452199", "10", null, "structure"))
    #3
  • /srv/www/htdocs/limesurvey4/framework/web/actions/CInlineAction.php(47): CAction->runWithParamsInternal(QuestionAdministrationController, ReflectionMethod, array("surveyid" => "452199", "gid" => "10"))
    #4
  • /srv/www/htdocs/limesurvey4/framework/web/CController.php(308): CInlineAction->runWithParams(array("surveyid" => "452199", "gid" => "10"))
    #5
  • /srv/www/htdocs/limesurvey4/framework/web/CController.php(286): CController->runAction(CInlineAction)
    #6
  • /srv/www/htdocs/limesurvey4/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array())
    #7
    – /srv/www/htdocs/limesurvey4/application/controllers/LSBaseController.php(160): CController->run("view")
    155 $this->redirect(array('/admin/authentication/sa/login'));
    156 }
    157 }
    158 }
    159
    160 parent::run($action);
    161 }
    162
    163 /*
    164
    Load and set session vars
    165 *
    #8
  • /srv/www/htdocs/limesurvey4/framework/web/CWebApplication.php(282): LSBaseController->run("view")
    #9
  • /srv/www/htdocs/limesurvey4/framework/web/CWebApplication.php(141): CWebApplication->runController("questionAdministration/view")
    #10
  • /srv/www/htdocs/limesurvey4/framework/base/CApplication.php(185): CWebApplication->processRequest()
    #11
    – /srv/www/htdocs/limesurvey4/index.php(182): CApplication->run()
    177 require_once APPPATH . 'core/LSYii_Application' . EXT;
    178
    179 $config = require_once(APPPATH . 'config/internal' . EXT);
    180
    181 Yii::$enableIncludePath = false;
    182 Yii::createApplication('LSYii_Application', $config)->run();
    183
    184 / End of file index.php /
    185 / Location: ./index.php /
image.png (7,892 bytes)   
image.png (7,892 bytes)   
cdorin

cdorin

2021-02-07 20:31

reporter   ~61985

The PR solves my issue, @aschwey . Please wait for it to be merged in the next 1-2 days. Then, pull again, clear assets cache (global settings), delete browser cache, and try again.

gabrieljenik

gabrieljenik

2021-02-08 12:59

manager   ~61997

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

lime_release_bot

lime_release_bot

2021-02-08 13:30

administrator   ~62004

Fixed in Release 4.4.2+210208

aschwey

aschwey

2021-02-09 12:09

reporter   ~62062

Thank you very much to all for fixing that issue so quickly. Great job, excellent service !

Related Changesets

LimeSurvey: master ec96f910

2021-02-08 12:59:44

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 17030: Can't add a question to a group (#1753) Affected Issues
17030
mod - application/controllers/QuestionAdministrationController.php Diff File

Issue History

Date Modified Username Field Change
2021-01-29 16:57 aschwey New Issue
2021-01-29 16:57 aschwey File Added: 2021-01-29 16_53_55-LimeSurvey et 3 pages de plus - Travail - Microsoft​ Edge.png
2021-01-29 16:57 aschwey File Added: 2021-01-29 16_55_14-500_ Internal Server Error et 3 pages de plus - Travail - Microsoft​ Edge.png
2021-01-29 17:18 cdorin Note Added: 61806
2021-01-29 17:36 aschwey Note Added: 61808
2021-01-29 17:44 cdorin Note Added: 61809
2021-01-29 18:15 aschwey Note Added: 61810
2021-01-29 18:35 aschwey Note Added: 61811
2021-01-30 09:34 DenisChenu Note Added: 61812
2021-01-30 12:20 aschwey Note Added: 61818
2021-01-30 14:56 DenisChenu Note Added: 61819
2021-01-30 17:34 cdorin Note Added: 61821
2021-01-30 17:34 cdorin Priority none => normal
2021-01-30 17:34 cdorin Status new => confirmed
2021-01-30 17:34 cdorin Description Updated
2021-01-30 17:34 cdorin Steps to Reproduce Updated
2021-01-30 17:34 cdorin Sync to Zoho Project => |Yes|
2021-02-04 16:12 gabrieljenik Note Added: 61950
2021-02-04 16:56 aschwey Note Added: 61951
2021-02-04 16:56 aschwey File Added: image.png
2021-02-07 20:31 cdorin Note Added: 61985
2021-02-08 12:59 gabrieljenik Changeset attached => LimeSurvey master ec96f910
2021-02-08 12:59 gabrieljenik Note Added: 61997
2021-02-08 12:59 gabrieljenik Assigned To => gabrieljenik
2021-02-08 12:59 gabrieljenik Resolution open => fixed
2021-02-08 13:30 lime_release_bot Sync to Zoho Project Yes => |Yes|
2021-02-08 13:30 lime_release_bot Note Added: 62004
2021-02-08 13:30 lime_release_bot Status confirmed => closed
2021-02-09 12:09 aschwey Note Added: 62062