Exception

Failed to generate title for question

/media/shnoulle/data/webdev/master/application/models/QuestionCreate.php(124)

112         $isTitleValid = false;
113         for ($i = 0; $i <= 999; $i++) {
114             $this->title =
115                 Question::getCodePrefix('question_code_prefix', $this->sid) .
116                 str_pad((safecount($survey->baseQuestions) + $i), 3, '0', STR_PAD_LEFT);
117             if ($this->validate(['title'])) {
118                 $isTitleValid = true;
119                 break;
120             }
121         }
122         if (!$isTitleValid) {
123             $this->title = null;
124             throw new Exception('Failed to generate title for question');
125         }
126     }
127 }

Stack Trace

#0
+
 /media/shnoulle/data/webdev/master/application/models/QuestionCreate.php(40): QuestionCreate->assignTemporaryTitle()
35         $oQuestion = new QuestionCreate();
36         $oQuestion->qid = 0;
37         $oQuestion->sid = $iSurveyId;
38         $oQuestion->gid = $gid;
39 
40         $oQuestion->assignTemporaryTitle();
41 
42         $aQuestionData = [
43                 'type' => $questionType,
44                 'other' => 'N',
45                 'mandatory' => 'N',
#1
+
 /media/shnoulle/data/webdev/master/application/controllers/QuestionAdministrationController.php(2292): QuestionCreate::getInstance()
2287             App()->request->getParam('surveyId');
2288         /** @var Question|null */
2289         $oQuestion = Question::model()->findByPk($iQuestionId);
2290 
2291         if (empty($oQuestion)) {
2292             $oQuestion = QuestionCreate::getInstance($iSurveyId, $sQuestionType, $questionThemeName);
2293         }
2294 
2295         if ($sQuestionType != null) {
2296             $oQuestion->type = $sQuestionType;
2297         }
#2
+
 /media/shnoulle/data/webdev/master/application/controllers/QuestionAdministrationController.php(2610): QuestionAdministrationController->getQuestionObject()
2605             }
2606             if ($oQuestion->sid != $sid) {
2607                 throw new CHttpException(400, gT("Invalid question id"));
2608             }
2609         } else {
2610             $oQuestion = $this->getQuestionObject();
2611             $oQuestion->parent_qid = 0; // Unsure needed it, but we need it's a parent_qid=0
2612         }
2613         $oQuestion->title = $code;
2614         header('Content-Type: application/json');
2615         if (!$oQuestion->validate(['title'])) {
2025-06-24 16:14:39 nginx/1.22.1 Yii Framework/1.1.30