unserialize error in AuthItem.php

The following error was displayed after I had installed srbac - yii version 1.1.7 on PHP 5.1.6 apache2.2 fedora.

Thus I have inserted into the AuthItem.php that if isset $this->data block, because that data was null and it caused the error. Do you think it as a necessary fix or there’s nicer fix?




  protected function afterFind() {

    parent::afterFind();

      if(isset($this->data)){

    $this->data = unserialize($this->data);

      }

  }






PHP Error


unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Argument is not a string


/var/www/html/kensaku/protected/modules/srbac/models/AuthItem.php(109)


097 //    parent::beforeSave();

098 //  }

099 

100 

101   protected function beforeSave() {

102     $this->data = serialize($this->data);

103     return parent::beforeSave();

104   }

105 

106   protected function afterFind() {

107     parent::afterFind();

108 //    if(isset($this->data)){

109     $this->data = unserialize($this->data);

110 //    }

111   }

112 

113   protected function afterSave() {

114     parent::afterSave();

115     $this->data = unserialize($this->data);

116     if($this->oldName != $this->name) {

117       $this->model()->updateByPk($this->oldName, array("name"=>$this->name));

118       $criteria = new CDbCriteria();

119       $criteria->condition = "itemname='".$this->oldName."'";

120       Assignments::model()->updateAll(array('itemname'=>$this->name),$criteria);

121       $criteria->condition = "parent='".$this->oldName."'";




sorry, I think it should be posted to a diffrent topic, so ignore this.