Avoid undefined index: null

Avoid Notice (8): Undefined index: null [APP/Vendor/cakephp/cakephp/lib/Cake/Model/Datasource/DboSource.php, line 1013]
also discussed here: 22b0275a58 (diff-b8a4043bec5d20830b77d240ae8fdef5R2087)
This commit is contained in:
Jan Ptacek 2018-07-30 11:17:24 +02:00 committed by GitHub
parent ee02d4274f
commit ca59191d5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1076,7 +1076,7 @@ class DboSource extends DataSource {
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
$schema = $Model->schema(); $schema = $Model->schema();
$valueInsert[] = $this->value($values[$i], $Model->getColumnType($fields[$i]), isset($schema[$fields[$i]]) ? $schema[$fields[$i]]['null'] : true); $valueInsert[] = $this->value($values[$i], $Model->getColumnType($fields[$i]), isset($schema[$fields[$i]]['null']) ? $schema[$fields[$i]]['null'] : true);
$fieldInsert[] = $this->name($fields[$i]); $fieldInsert[] = $this->name($fields[$i]);
if ($fields[$i] === $Model->primaryKey) { if ($fields[$i] === $Model->primaryKey) {
$id = $values[$i]; $id = $values[$i];