not a bug in 1.0.6 actually, but changing tinyint(1) to boolean? why?

Hey, I've tried to upgrade from Yii 105 to Yii 106 and found out the follow situation:

The action ApprovePost doesn't work on Yii 106

in Post model:


    * @approves a particular post


    public function approve()


        $this->postStatus = Post::STATUS_PUBLISHED;

        if ( $this->save() ) {

            return true;



in PostController

    public function actionApprovePost()




            if ( $post->approve() )






		throw new CHttpException(500,'Nice try.');


in view post/list

        [<?php echo ($model->postStatus != Post::STATUS_PUBLISHED)? CHtml::linkButton('Publish',array('submit'=>array('approvePost','id'=>$model->postId),'confirm'=>'Sure?')):'Published'; ?>]

        [<?php echo ($model->postStatus != Post::STATUS_ARCHIVED) ? CHtml::linkButton('Archive',array('submit'=>array('archivePost','id'=>$model->postId,'status'=>$status),'confirm'=>'Sure?')):'Archived'; ?>]

When I click Publish or Archive, the system just reloads the page, it performs the action in model Post, but status is not updated. Even if I enter the Modify page and click the activeDropDownList to change the status value, the value is not saved…

I changed to Yii 105 back and it works great…


five minutes later, I read in Yii's changelog:

New #349: Enhanced MySQL driver to recongize tinyint(1) as a boolean (Qiang)

All my status fields were tinyint(1), turning all them into int(1) solved the problem…

But i don't really understand the reason for treating tinyint(1) as boolean…

Anyway, if somebody is facing a similar problem…


I think it's better to keep tinyint(1) as is instead of boolean. I just rolled back the change. Thanks.


I think it's better to keep tinyint(1) as is instead of boolean. I just rolled back the change. Thanks.

Loose comparisons for the win? :)

Thank you very much, Qiang!

best regards!!


I've just hit this problem. I had a column indicating a resource type (1=>server, 2=>application) and the corresponding table column was designated as tinyint(1). Whatever I did, I could not insert any resource of type 2. Searching the relevant change in 1.0.6, I manually reverted it back, until 1.0.7 is out and now all is fine.