diff --git a/framework/yii/db/ColumnSchema.php b/framework/yii/db/ColumnSchema.php index cd2d9fa..3e7f6cf 100644 --- a/framework/yii/db/ColumnSchema.php +++ b/framework/yii/db/ColumnSchema.php @@ -87,12 +87,12 @@ class ColumnSchema extends Object */ public function typecast($value) { + if ($value === '' && $this->type !== Schema::TYPE_TEXT && $this->type !== Schema::TYPE_STRING && $this->type !== Schema::TYPE_BINARY) { + return null; + } if ($value === null || gettype($value) === $this->phpType || $value instanceof Expression) { return $value; } - if ($value === '' && $this->type !== Schema::TYPE_TEXT && $this->type !== Schema::TYPE_STRING) { - return null; - } switch ($this->phpType) { case 'string': return (string)$value;