Commit 7b908aa8 by Qiang Xue

Fixes #2853: ActiveRecord did not handle resource-typed columns well

parent bea8f946
......@@ -6,6 +6,7 @@ Yii Framework 2 Change Log
- Bug #2563: Theming is not working if the path map of the theme contains ".." or "." in the paths (qiangxue)
- Bug #2801: Fixed the issue that GridView gets footer content before data cells content (ElisDN)
- Bug #2853: ActiveRecord did not handle resource-typed columns well (chris68, qiangxue)
- Bug #3042: `yii\widgets\Pjax` should end application right after it finishes responding to a pjax request (qiangxue)
- Bug #3066: `yii\db\mssql\Schema::getTableSchema()` should return null when the table does not exist (qiangxue)
- Bug #3091: Fixed inconsistent treatment of `Widget::run()` when a widget is used as a container and as a self-contained object (qiangxue)
......
......@@ -94,7 +94,7 @@ class ColumnSchema extends Object
}
switch ($this->phpType) {
case 'string':
return (string) $value;
return is_resource($value) ? $value : (string) $value;
case 'integer':
return (integer) $value;
case 'boolean':
......
......@@ -452,11 +452,13 @@ abstract class Schema extends Object
*/
protected function getColumnPhpType($column)
{
static $typeMap = [ // abstract type => php type
static $typeMap = [
// abstract type => php type
'smallint' => 'integer',
'integer' => 'integer',
'boolean' => 'boolean',
'float' => 'double',
'binary' => 'resource',
];
if (isset($typeMap[$column->type])) {
if ($column->type === 'integer') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment