Fix getDockerJSON: If docker comms fail, return empty array (as expsected by everyone) instead if null. Fixes foreach() argument must be of type array|object, null given

This commit is contained in:
Robin Kluth
2024-02-28 06:34:06 +01:00
parent d036c7a086
commit a702f65759

View File

@@ -721,7 +721,7 @@ class DockerClient {
$fp = stream_socket_client('unix:///var/run/docker.sock', $errno, $errstr);
if ($fp === false) {
echo "Couldn't create socket: [$errno] $errstr";
return null;
return [];
}
$protocol = $unchunk ? 'HTTP/1.0' : 'HTTP/1.1';
$out = "$method {$api}{$url} $protocol\r\nHost:127.0.0.1\r\nConnection:Close\r\n";