Memcached always reporting app_state = 'ERROR'

./validate.php output: Untitled - LibreNMS

During application polling for memcached, the response data is sent to update_application() as an array, not a string. This results in a PHP warning when attempting to use str_contains on $response, and causes $data['app_state'] to be set to 'ERROR'.

Here is the code in context, ./includes/polling/functions.inc.php line 567:

if ($response != '' && $response !== false) {
    if (str_contains($response, array(
        'Traceback (most recent call last):',
    ))) {
        $data['app_state'] = 'ERROR';
    } else {
        $data['app_state'] = 'OK';
    }
}

It looks like passing $response to update_application() is just to check if there is a Traceback thrown. Encapsulating the response data with json_encode() in ./includes/polling/applications/memcached.inc.php fixes that on my install:

update_application($app, json_encode($data), $fields);