I'm using EXT:brevo without DOI and got a problem with submission via Brevo API.
[ERROR] request="d0a6953ee7bc8" component="StudioMitte.Brevo.Finishers.BrevoFinisher": [400] Client error: `POST https://api.brevo.com/v3/contacts` resulted in a `400 Bad Request` response:
{"code":"invalid_parameter","message":"listIds should be type array"}
Turns out that listIds property of CreateContact must be a list, but in my case EXT:brevo sets the property as following array (list ID is set as finisher option in form.yaml):
This is an array, but not a list. I think the reason is that I have no defaultListIds set in extension configuration and the following code in Configuration.php produces an empty array that has internal key pointer set to 1:
$this->defaultListIds = GeneralUtility::intExplode(',', $settings['defaultListIds'] ?? '', true);
Behind the scenes the following happens:
php > $listIds = explode(',', '');
php > var_dump($listIds);
array(1) {
[0]=>
string(0) ""
}
php > unset($listIds[0]); // GeneralUtility::intExplode(..., $removeEmptyValues = true)
php > $listIds[] = 107; // Add list id from form.yaml
php > var_dump($listIds);
array(1) {
[1]=>
int(107)
}
I'm using
EXT:brevowithout DOI and got a problem with submission via Brevo API.Turns out that
listIdsproperty ofCreateContactmust be a list, but in my caseEXT:brevosets the property as following array (list ID is set as finisher option inform.yaml):This is an array, but not a list. I think the reason is that I have no
defaultListIdsset in extension configuration and the following code inConfiguration.phpproduces an empty array that has internal key pointer set to1:Behind the scenes the following happens: