Undefined array key 3 on getProfiles endpoint when using more than 3 arguments
I have the following line of code
$response = $this->klaviyoAPI->Profiles->getProfiles(filter: $filter, apiKey: config('klaviyo.api_token'), page_cursor: $pageCursor, page_size: $pageSize);
This give me the following error
ErrorException
Undefined array key 3
at vendor/klaviyo/api/lib/Subclient.php:47
43▕ $param_position = $param->getPosition();
44▕
45▕ if (count($args) > $param_position) {
46▕
➜ 47▕ $page_cursor = $args[$param_position];
48▕ if ($page_cursor != NULL) {
49▕ $page_cursor = $this->new_page_cursor($page_cursor);
50▕
51▕ $args[$param_position] = $page_cursor;
If I reduce the amount of arguments to 3, it works correctly. Also, by stepping through the code above, I notice that the $args array in line 47 does indeed not have numbered keys, but named keys, which is why it fails.
thank you for bringing this to our attention! we will take a look.
I believe the issue is that you are using page_cursor with page_size. I don't believe you can use both at the same time (as page_cursor encodes a fixed page_size from the initial query.
I will look into this further to see if I find anything else to share.
This is because the Subclient logic here in __call() does not properly support named arguments.
See my PR for a proper fix for this: https://github.com/klaviyo/klaviyo-api-php/pull/50