PHP warning

Invalid argument supplied for foreach()

/mnt/data/shnoulle/nginx/www/mastervanilla/application/models/TemplateManifest.php(281)

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

Stack Trace

#0
+
 /mnt/data/shnoulle/nginx/www/mastervanilla/application/models/TemplateManifest.php(236): TemplateManifest->parseDefaultData("survey", array("active" => "Y", "allowsave" => "Y", "tokenanswerspersistence" => "Y", "format" => "G", ...))
231 
232         if (empty($this->templateEditor)) {
233             return $thissurvey;
234         }
235 
236         $thissurvey = $this->parseDefaultData('survey', $thissurvey);
237         $thissurvey['aGroups'][1] = $this->parseDefaultData('group', $thissurvey['aGroups'][1]);
238         $thissurvey['aGroups'][1]["aQuestions"][1] = $this->parseDefaultData('question_1', $thissurvey['aGroups'][1]["aQuestions"][1]) ;
239         $thissurvey['aGroups'][1]["aQuestions"][2] = $this->parseDefaultData('question_2', $thissurvey['aGroups'][1]["aQuestions"][2]);
240         $thissurvey['aAssessments']["datas"]["total"][0] = $this->parseDefaultData('assessments', $thissurvey['aAssessments']["datas"]["total"][0]);
241 
#1
+
 /mnt/data/shnoulle/nginx/www/mastervanilla/application/models/TemplateManifest.php(196): TemplateManifest->getDefaultDataForRenderingFromXml(array("active" => "Y", "allowsave" => "Y", "tokenanswerspersistence" => "Y", "format" => "G", ...))
191     public function getDefaultDataForRendering($thissurvey=array())
192     {
193 
194       $thissurvey    = empty($thissurvey)?$this->getDefaultCoreDataForRendering():$thissurvey;
195 
196       $thissurvey = $this->getDefaultDataForRenderingFromXml($thissurvey);
197 
198       //$thissurvey['alanguageChanger'] = $this->getDefaultDataForLanguageChanger();
199 
200       // Redundant values
201       $thissurvey['surveyls_title'] = $thissurvey['name'];
#2
+
 /mnt/data/shnoulle/nginx/www/mastervanilla/application/controllers/admin/themes.php(979): TemplateManifest->getDefaultDataForRendering()
974         $siteadminemail = Yii::app()->getConfig('siteadminemail');
975 
976         // NB: Used by answer print PDF layout.
977         $print = [];
978 
979         $thissurvey  = $oEditedTemplate->getDefaultDataForRendering();
980         $templatedir = $oEditedTemplate->viewPath;
981         $templateurl = getTemplateURL($templatename);
982 
983         // Save these variables in an array
984         // TODO: check if this aData is still used
2019-10-03 14:26:02 nginx/1.16.1 Yii Framework/1.1.21