Hi,
since I upgrade yii 1.1.12 to 1.1.13, my app crash.
I have 4 DB conections: 1xOracle 10g, 3x MySQL 5.2 and 1xMySQL 4.1, used by several models.
Using 1.1.12 my App works fine. Using 1.1.13, I get "Undefined index: Comment" only with models related MySQL 4.
But I haven’t any field “Comment”… Perhaps it is referered to Comment field attribute.
PHP notice
Undefined index: Comment
/var/tvaprivado/yii/framework/db/schema/mysql/CMysqlSchema.php(199)
187 * @return CDbColumnSchema normalized column metadata
188 */
189 protected function createColumn($column)
190 {
191 $c=new CMysqlColumnSchema;
192 $c->name=$column['Field'];
193 $c->rawName=$this->quoteColumnName($c->name);
194 $c->allowNull=$column['Null']==='YES';
195 $c->isPrimaryKey=strpos($column['Key'],'PRI')!==false;
196 $c->isForeignKey=false;
197 $c->init($column['Type'],$column['Default']);
198 $c->autoIncrement=strpos(strtolower($column['Extra']),'auto_increment')!==false;
199 $c->comment=$column['Comment']; <---CRASH
200
201 return $c;
202 }
203
204 /**
205 * @return float server version.
206 */
207 protected function getServerVersion()
208 {
209 $version=$this->getDbConnection()->getAttribute(PDO::ATTR_SERVER_VERSION);
210 $digits=array();
211 preg_match('/(\d+)\.(\d+)\.(\d+)/', $version, $digits);
Stack Trace
#0 /var/tvaprivado/yii/framework/db/schema/mysql/CMysqlSchema.php(167): CMysqlSchema->createColumn(array("Field" => "email", "Type" => "varchar(80)", "Null" => "", "Key" => "PRI", ...))
#1 /var/tvaprivado/yii/framework/db/schema/mysql/CMysqlSchema.php(119): CMysqlSchema->findColumns(CMysqlTableSchema)
#2 /var/tvaprivado/yii/framework/db/schema/CDbSchema.php(103): CMysqlSchema->loadTable("users")
#3 /var/tvaprivado/yii/framework/db/ar/CActiveRecord.php(2309): CDbSchema->getTable("users")
#4 /var/tvaprivado/yii/framework/db/ar/CActiveRecord.php(387): CActiveRecordMetaData->__construct(Users)
#5 /var/tvaprivado/yii/framework/web/CActiveDataProvider.php(74): CActiveRecord::model("Users")
#6 /var/tvaprivado/francisco/protected/controllers/UsersController.php(251): CActiveDataProvider->__construct("Users", array("criteria" => array("order" => "email DESC"), "pagination" => array("pageSize" => 10)))
246 'order'=>'email DESC',
247 ),
248 'pagination'=>array(
249 'pageSize'=>10,
250 ),
251 ));
252 $this->render('index',array(
253 'dataProvider'=>$dataProvider,
254 )); // <--CRASH!
255 }
256
#7 /var/tvaprivado/yii/framework/web/actions/CInlineAction.php(49): UsersController->actionIndex()
#8 /var/tvaprivado/yii/framework/web/CController.php(308): CInlineAction->runWithParams(array("r" => "Users"))
#9 /var/tvaprivado/yii/framework/web/filters/CFilterChain.php(133): CController->runAction(CInlineAction)
#10 /var/tvaprivado/yii/framework/web/filters/CFilter.php(40): CFilterChain->run()
#11 /var/tvaprivado/yii/framework/web/CController.php(1145): CFilter->filter(CFilterChain)
#12 /var/tvaprivado/yii/framework/web/filters/CInlineFilter.php(58): CController->filterAccessControl(CFilterChain)
#13 /var/tvaprivado/yii/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter(CFilterChain)
#14 /var/tvaprivado/yii/framework/web/CController.php(291): CFilterChain->run()
#15 /var/tvaprivado/yii/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array("accessControl"))
#16 /var/tvaprivado/yii/framework/web/CWebApplication.php(282): CController->run("")
#17 /var/tvaprivado/yii/framework/web/CWebApplication.php(141): CWebApplication->runController("Users")
#18 /var/tvaprivado/yii/framework/base/CApplication.php(169): CWebApplication->processRequest()
#19 /var/tvaprivado/francisco/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',1);
11
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
Apache/2.2.16 (Debian 6) Yii Framework/1.1.13 PHP 5.3.3
EDIT:
I solved temporaly:
/**
* Creates a table column.
* @param array $column column metadata
* @return CDbColumnSchema normalized column metadata
*/
protected function createColumn($column)
{
$c=new CMysqlColumnSchema;
$c->name=$column['Field'];
$c->rawName=$this->quoteColumnName($c->name);
$c->allowNull=$column['Null']==='YES';
$c->isPrimaryKey=strpos($column['Key'],'PRI')!==false;
$c->isForeignKey=false;
$c->init($column['Type'],$column['Default']);
$c->autoIncrement=strpos(strtolower($column['Extra']),'auto_increment')!==false;
//$c->comment=$column['Comment'];
$c->comment='';
return $c;
}