- Issue created by @pianomansam
- Status changed to Needs review
over 1 year ago 7:25pm 12 May 2023
When importing string data in a JSON field, I get the following error:
TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in count() (line 68 of migrate_source_jsonpath/src/Plugin/migrate/process/GetByJsonPath.php
Diving into the code, it looks like GetByJsonPath assumes that $result is an array. You can see this is true right on line 68:
// If returned only one value.
if (1 == count($result)) {
$this->multiple = FALSE;
$result = reset($result);
}
Update the code to handle strings.
Create and test a patch.
Needs review
1.0
Code