Skip to content

Commit

Permalink
Fixes yiisoft#5780: QueryBuilder::batchInsert() may cause "undefine…
Browse files Browse the repository at this point in the history
…d index" error
  • Loading branch information
qiangxue committed Oct 27, 2014
1 parent 2a6c0b7 commit 5bdf36d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Yii Framework 2 Change Log
- Bug #5682: The `asset` command would incorrectly combine CSS files when `UrlManager::linkAssets` is true (dmvslv)
- Bug #5702: Parenthesis should be automatically added to `Validator::whenClient` to avoid js error (mdmunir, qiangxue)
- Bug #5745: Gii and debug modules may cause 404 exception when the route contains dashes (qiangxue)
- Bug #5780: `QueryBuilder::batchInsert()` may cause "undefined index" error (qiangxue)
- Bug: Gii console command help information does not contain global options (qiangxue)
- Bug: `yii\web\UrlRule` was unable to create URLs for rules containing unicode characters (samdark)
- Enh #5223: Query builder now supports selecting sub-queries as columns (qiangxue)
Expand Down
2 changes: 1 addition & 1 deletion framework/db/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function batchInsert($table, $columns, $rows)
foreach ($rows as $row) {
$vs = [];
foreach ($row as $i => $value) {
if (!is_array($value) && isset($columnSchemas[$columns[$i]])) {
if (!is_array($value) && isset($columns[$i]) && isset($columnSchemas[$columns[$i]])) {
$value = $columnSchemas[$columns[$i]]->dbTypecast($value);
}
if (is_string($value)) {
Expand Down

0 comments on commit 5bdf36d

Please sign in to comment.