PHP warning

Invalid argument supplied for foreach()

/mnt/data/shnoulle/nginx/www/3LTS/application/models/TemplateManifest.php(285)

273       }
274 
275       return $thissurvey;
276     }
277 
278 
279     protected function parseDefaultData($sXpath, $aArrayToFeed)
280     {
281 
282       $oDataFromXML = $this->templateEditor->default_data->xpath('//'.$sXpath);
283       $oDataFromXML = end($oDataFromXML);
284 
285       foreach( $oDataFromXML as $sKey => $oData){
286 
287         if (!empty($sKey)){
288 
289           $sData = (string) $oData;
290 
291           if ($oData->attributes()->twig == "on") {
292             $sData = Yii::app()->twigRenderer->convertTwigToHtml($sData);
293           }
294 
295           $aArrayToFeed[$sKey] = $sData;
296         }
297       }

Stack Trace

#0
+
 /mnt/data/shnoulle/nginx/www/3LTS/application/models/TemplateManifest.php(240): TemplateManifest->parseDefaultData("survey", array("active" => "Y", "allowsave" => "Y", "tokenanswerspersistence" => "Y", "format" => "G", ...))
235 
236         if (empty($this->templateEditor)) {
237             return $thissurvey;
238         }
239 
240         $thissurvey = $this->parseDefaultData('survey', $thissurvey);
241         $thissurvey['aGroups'][1] = $this->parseDefaultData('group', $thissurvey['aGroups'][1]);
242         $thissurvey['aGroups'][1]["aQuestions"][1] = $this->parseDefaultData('question_1', $thissurvey['aGroups'][1]["aQuestions"][1]) ;
243         $thissurvey['aGroups'][1]["aQuestions"][2] = $this->parseDefaultData('question_2', $thissurvey['aGroups'][1]["aQuestions"][2]);
244         $thissurvey['aAssessments']["datas"]["total"][0] = $this->parseDefaultData('assessments', $thissurvey['aAssessments']["datas"]["total"][0]);
245 
#1
+
 /mnt/data/shnoulle/nginx/www/3LTS/application/models/TemplateManifest.php(200): TemplateManifest->getDefaultDataForRenderingFromXml(array("active" => "Y", "allowsave" => "Y", "tokenanswerspersistence" => "Y", "format" => "G", ...))
195     public function getDefaultDataForRendering($thissurvey=array())
196     {
197 
198       $thissurvey    = empty($thissurvey)?$this->getDefaultCoreDataForRendering():$thissurvey;
199 
200       $thissurvey = $this->getDefaultDataForRenderingFromXml($thissurvey);
201 
202       //$thissurvey['alanguageChanger'] = $this->getDefaultDataForLanguageChanger();
203 
204       // Redundant values
205       $thissurvey['surveyls_title'] = $thissurvey['name'];
#2
+
 /mnt/data/shnoulle/nginx/www/3LTS/application/controllers/admin/themes.php(1032): TemplateManifest->getDefaultDataForRendering()
1027         $siteadminemail = Yii::app()->getConfig('siteadminemail');
1028 
1029         // NB: Used by answer print PDF layout.
1030         $print = [];
1031 
1032         $thissurvey  = $oEditedTemplate->getDefaultDataForRendering();
1033         $templatedir = $oEditedTemplate->viewPath;
1034         $templateurl = getTemplateURL($templatename);
1035 
1036         // Save these variables in an array
1037         // TODO: check if this aData is still used
2021-03-10 16:34:51 nginx/1.18.0 Yii Framework/1.1.22-dev