Browse Source

Check availabilty field in BaseActiveRecord::populateRecord

check with Object::canSetProperty()

fixes #4305, close #4211
tags/2.0.0-rc
miramir 10 years ago committed by Carsten Brandt
parent
commit
67bd4972ba
  1. 1
      framework/CHANGELOG.md
  2. 2
      framework/db/BaseActiveRecord.php

1
framework/CHANGELOG.md

@ -186,6 +186,7 @@ Yii Framework 2 Change Log
- Chg #4071: `mail` component renamed to `mailer`, `yii\log\EmailTarget::$mail` renamed to `yii\log\EmailTarget::$mailer` (samdark)
- Chg #4147: `BaseMailer::compose()` will not overwrite the `message` parameter if it is explicitly provided (qiangxue)
- Chg #4201: change default value of `SyslogTarget::facility` from LOG_SYSLOG to LOG_USER (dizews)
- Chg #4211: BaseActiveRecord::populateRecord now silently hide selected columns that are not defined in AR instead of failing with an error (miramir)
- Chg #4227: `\yii\widgets\LinkPager::$hideOnSinglePage` is now `true` by default (samdark)
- Chg #4310: Removed `$data` from signature of `yii\rbac\ManagerInterface` (samdark)
- Chg #4318: `yii\helpers\Html::ul()` and `ol()` will return an empty list tag if an empty item array is given (qiangxue)

2
framework/db/BaseActiveRecord.php

@ -1042,7 +1042,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
foreach ($row as $name => $value) {
if (isset($columns[$name])) {
$record->_attributes[$name] = $value;
} else {
} elseif ($record->canSetProperty($name)) {
$record->$name = $value;
}
}

Loading…
Cancel
Save