1
Error
ErrorException: array_merge(): Argument #1 is not an array in /my/server/vendor/podio/podio-php/lib/PodioObject.php:200
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'array_merge(): ...', '/my/server/...', 200, Array)
#1 /my/server/vendor/podio/podio-php/lib/PodioObject.php(200): array_merge(NULL, Array)
#2 /my/server/vendor/podio/podio-php/models/PodioApp.php(39): PodioObject::member(Object(PodioResponse))
#3 /my/path.php(413): PodioApp::get(xxxxxxx)

This appears to be a bug with the Podio PHP SDK or Podio API. The json_response (which is causing the array_merge error) is null, yet the http response is 200. I cannot get it to occur regularly, however it occurs roughly 10% of the time on script that is running 30~ of these calls. I can run the GetApp call directly from the documentation just fine.

I know it's an error with the responses because my script breaks at different places on each rerun depending on which data hasn't been loaded from the API correctly.

Test 1: Exception at line 344 as the result of $app1 being null

Test 2: Exception at line 814 as the result of $app3 being null

etc...

This is a script that was not modified and has been in place for over 6 months, but stopped working sometime last week.

EDIT: I've also confirmed that the same error occurs with cURL, so it isn't an SDK-specific issue.

Community
  • 1
  • 1
Nathanael
  • 954
  • 3
  • 19
  • 39
  • Could you share sample php code that can reproduce this issue? (of-course without your clientID/clientSecret and other private/confidential info) – Pavlo - Podio Jul 11 '18 at 00:33
  • I can reproduce it by running \PodioApp::get($app); where $app is one of... 19641970, 19641961, 18706934, for example. If you create an array that is each of those apps, running the app::get call 50 times, you'll be able to reproduce the error. I've tested with multiple user access_tokens accounts fwiw. Thank you! – Nathanael Jul 11 '18 at 02:24

2 Answers2

2

The same intermittent error is occurring for us also. Since the TLS change was rolled out.

A temporary workaround is to wrap calls in a do while loop to retry when there are errors.

E.g.

// Get item from API
$attempts = 0;
do {
    try {
        $item = PodioItem::get($itemId);
    } catch (\Exception $e) {
        $attempts++;
        Log::error("PodioItemGetFailure #" . $attempts . ". " . $e->getMessage());
        sleep(3);
        continue;
    }
    break;
} while ($attempts < 3);

This is a bit nasty, so hopefully we have a resolution on the causes on Podio's side soon.

  • 1
    Has it been occurring for you with PodioItem::get as well? Good to know if it is all endpoints. We've only had issues with getting apps at present, however the implementation we're using makes ~3 dozen app calls for every item call. – Nathanael Jul 11 '18 at 06:27
  • 1
    I also implemented a try/catch earlier to no avail - the same error was thrown regardless. Might have been my implementation of it. I'll try again. Thank you! – Nathanael Jul 11 '18 at 06:28
  • It's happening (randomly) on all of the get requests as far as I can tell. I had to play around a bit with the error catching to ensure I was catching the right thing. Take note of the \ before \Error, that was the key for me. Depends on your namespaces though. – furtherance Jul 11 '18 at 07:11
1

This intermittent errors should not be happening anymore :)
Unless your network connection is unstable or choppy.

Anyway it's good to have proper handling for network-dependent calls (like any Podio API call). I can only suggest that all Podio API calls should go through queueing mechanism that will allow retry in case if network is unstable or Podio is on maintenance (as example).

Pavlo - Podio
  • 2,003
  • 2
  • 10
  • 19
  • Having handling for network dependent calls is definitely ideal- however that gets obfuscated when the HTTP Status Code doesn't match the data being returned =) Thank you again... – Nathanael Jul 20 '18 at 23:02