Salve,
continuo a ricevere questo messaggio di errore la prima volta che entro nel sito o dopo qualche minuto che non aggiorno la pagina.
Non riesco a capire cosa possa essere anche perché l’errore svanisce al refresh. Mi pare che l’errore risieda nella traduzione (o meglio nella chiamata della funzione Yii::t()) ma non riesco a venirne a capo.
Nella classe Controller.php ho aggiunto queste righe all’init in modo da settarmi sempre la lingua corretta:
public function init() {
if (!isset(Yii::app()->session['defaultLangCode'])){
$_defaultCode = Language::model()->default()->code()->find();
Yii::app()->session['defaultLangCode'] = $_defaultCode;
}
if (!$_defaultCode->code == "" && !isset(Yii::app()->session['lang']))
Yii::app()->setLanguage(Yii::app()->session['defaultLangCode']);
if (isset(Yii::app()->session['lang']))
Yii::app()->setLanguage(Yii::app()->session['lang']);
}
ma non credo sia nemmeno lì l’errore. Probabilmente è dovuto al fatto che sto usando un tema ma non ne sono certo. Potreste darmi qualche suggerimento in merito?
PHP warning
Illegal offset type
/var/www/vhosts/sardegnacountry.com/httpdocs/framework/i18n/CPhpMessageSource.php(101)
089 protected function getMessageFile($category,$language)
090 {
091 if(!isset($this->_files[$category][$language]))
092 {
093 if(($pos=strpos($category,'.'))!==false)
094 {
095 $moduleClass=substr($category,0,$pos);
096 $moduleCategory=substr($category,$pos+1);
097 $class=new ReflectionClass($moduleClass);
098 $this->_files[$category][$language]=dirname($class->getFileName()).DIRECTORY_SEPARATOR.'messages'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.$moduleCategory.'.php';
099 }
100 else
101 $this->_files[$category][$language]=$this->basePath.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.$category.'.php';
102 }
103 return $this->_files[$category][$language];
104 }
105
106 /**
107 * Loads the message translation for the specified language and category.
108 * @param string $category the message category
109 * @param string $language the target language
110 * @return array the loaded messages
111 */
112 protected function loadMessages($category,$language)
113 {
Stack Trace
#0
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/i18n/CPhpMessageSource.php(114): CPhpMessageSource->getMessageFile("pageBody", Language)
#1
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/i18n/CMessageSource.php(104): CPhpMessageSource->loadMessages("pageBody", Language)
#2
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/i18n/CMessageSource.php(86): CMessageSource->translateMessage("pageBody", "Where To Sleep", Language)
#3
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/YiiBase.php(574): CMessageSource->translate("pageBody", "Where To Sleep", null)
#4
– /var/www/vhosts/sardegnacountry.com/httpdocs/themes/sardegna/views/site/_searchForm.php(2): YiiBase::t("pageBody", "Where To Sleep")
1 <div class="navsin">
2 <h3 class="up"><?php echo(Yii::t('pageBody', 'Where To Sleep')); ?></h3>
3 <?php
4 $form = $this->beginWidget('GxActiveForm', array(
5 'id' => 'searchform',
6 'action' => Yii::app()->createUrl($this->route),
7 'enableAjaxValidation' => true,
#5
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CBaseController.php(127): require("/var/www/vhosts/sardegnacountry.com/httpdocs/themes/sardegna/vie...")
#6
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CBaseController.php(96): CBaseController->renderInternal("/var/www/vhosts/sardegnacountry.com/httpdocs/themes/sardegna/vie...", array("model" => SearchStructureForm), true)
#7
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CController.php(870): CBaseController->renderFile("/var/www/vhosts/sardegnacountry.com/httpdocs/themes/sardegna/vie...", array("model" => SearchStructureForm), true)
#8
– /var/www/vhosts/sardegnacountry.com/httpdocs/themes/sardegna/views/site/index.php(9): CController->renderPartial("_searchForm", array("model" => SearchStructureForm))
04 if (!empty($hpimages))
05 $this->widget('application.extensions.jnterface.uGallery', array('imageDir' => 'images/gal_images', 'texts' => $hpimages));
06 ?>
07 </div>
08 <div class="span-5">
09 <?php echo($this->renderPartial('_searchForm',array('model'=>$searchModule))); ?>
10 <?php echo($this->renderPartial('_eventitinerarySearch',array('model'=>$eventModel))); ?>
11 </div>
12
13 <div class="span-22">
14 <br/>
#9
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CBaseController.php(127): require("/var/www/vhosts/sardegnacountry.com/httpdocs/themes/sardegna/vie...")
#10
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CBaseController.php(96): CBaseController->renderInternal("/var/www/vhosts/sardegnacountry.com/httpdocs/themes/sardegna/vie...", array("events" => CActiveDataProvider, "eventModel" => searchEventForm, "hpimages" => array("2.jpg" => array("title" => "Delizie culinarie", "description" => "Un invito ad assaporare i piatti della Sardegna</p>"), "3.jpg" => array("title" => "lorem ipsum", "description" => "bla bla bla</p>"), "4.jpg" => array("title" => "lorem ipsum", "description" => "sdafdasfa sdfafa</p>"), "6.jpg" => array("title" => "Foto galleria home page", "description" => "sdfg dfgsdgr</p>"), ...), "searchModule" => SearchStructureForm, ...), true)
#11
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CController.php(870): CBaseController->renderFile("/var/www/vhosts/sardegnacountry.com/httpdocs/themes/sardegna/vie...", array("events" => CActiveDataProvider, "eventModel" => searchEventForm, "hpimages" => array("2.jpg" => array("title" => "Delizie culinarie", "description" => "Un invito ad assaporare i piatti della Sardegna</p>"), "3.jpg" => array("title" => "lorem ipsum", "description" => "bla bla bla</p>"), "4.jpg" => array("title" => "lorem ipsum", "description" => "sdafdasfa sdfafa</p>"), "6.jpg" => array("title" => "Foto galleria home page", "description" => "sdfg dfgsdgr</p>"), ...), "searchModule" => SearchStructureForm, ...), true)
#12
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CController.php(783): CController->renderPartial("index", array("events" => CActiveDataProvider, "eventModel" => searchEventForm, "hpimages" => array("2.jpg" => array("title" => "Delizie culinarie", "description" => "Un invito ad assaporare i piatti della Sardegna</p>"), "3.jpg" => array("title" => "lorem ipsum", "description" => "bla bla bla</p>"), "4.jpg" => array("title" => "lorem ipsum", "description" => "sdafdasfa sdfafa</p>"), "6.jpg" => array("title" => "Foto galleria home page", "description" => "sdfg dfgsdgr</p>"), ...), "searchModule" => SearchStructureForm, ...), true)
#13
– /var/www/vhosts/sardegnacountry.com/httpdocs/protected/controllers/site/indexAction.php(77): CController->render("index", array("events" => CActiveDataProvider, "eventModel" => searchEventForm, "hpimages" => array("2.jpg" => array("title" => "Delizie culinarie", "description" => "Un invito ad assaporare i piatti della Sardegna</p>"), "3.jpg" => array("title" => "lorem ipsum", "description" => "bla bla bla</p>"), "4.jpg" => array("title" => "lorem ipsum", "description" => "sdafdasfa sdfafa</p>"), "6.jpg" => array("title" => "Foto galleria home page", "description" => "sdfg dfgsdgr</p>"), ...), "searchModule" => SearchStructureForm, ...))
72
73 $_structures = Datatolist::model()->GetStructuresDataSet($_freesearch, $_town, $_province, $_name, $_short_description);
74 $_events = Eventtolist::model()->GetEventDataProvider($_allProvince,$_province);
75 $_elementCount = count($_structures->getData());
76 $_structures->setTotalItemCount($_elementCount);
77 $this->controller->render('index', array('events'=>$_events,'eventModel' => $_searchEventModel, 'hpimages' => $_hpimages, 'searchModule' => $_searchModel, 'structures' => $_structures));
78 }
79
80 }
81
82 ?>
#14
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/actions/CAction.php(75): indexAction->run()
#15
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CController.php(309): CAction->runWithParams(array())
#16
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CController.php(287): CController->runAction(indexAction)
#17
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CController.php(266): CController->runActionWithFilters(indexAction, array())
#18
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CWebApplication.php(276): CController->run("")
#19
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/web/CWebApplication.php(135): CWebApplication->runController("")
#20
+ /var/www/vhosts/sardegnacountry.com/httpdocs/framework/base/CApplication.php(162): CWebApplication->processRequest()
#21
+ /var/www/vhosts/sardegnacountry.com/httpdocs/index.php(13): CApplication->run()