Skip to content

Commit

Permalink
Improve data type checking before dereferencing, log if unexpected (#274
Browse files Browse the repository at this point in the history
)
  • Loading branch information
thierrydallacroce authored Dec 18, 2019
1 parent d26de9c commit e7c6d7c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/custom/dkan_data/src/ValueReferencer.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,18 @@ protected function dereferenceProperty(string $property_id, $data) {
if (is_array($data)) {
return $this->dereferenceMultiple($property_id, $data);
}
else {
elseif (is_string($data)) {
return $this->dereferenceSingle($property_id, $data);
}
else {
Drupal::logger('value_referencer')->error(
'Unexpected data type when dereferencing property_id @property_id with data "@data"',
[
'@property_id' => property_id,
'@$data' => var_export($data, TRUE),
]
);
}
}

/**
Expand Down

0 comments on commit e7c6d7c

Please sign in to comment.