Error while modifying web proxy options

NethServer Version: 7.6.1810
Module: nethserver-httpd-admin-2.3.4-1.ns7 | nethserver-squid-1.7.4-1.ns7

This error is shown on journal every time I modify something on Web Proxy:

httpd[5120]: [2] max(): Array must contain at least one element - File /usr/share/nethesis/NethServer/Module/Proxy/Rules/Modify.php, line 132

I can’t reproduce. Can you check if you have downloaded correctly the blacklist?
Have you got any proxy or httpd personalization?
You can also try to reinstall nethserver-lightsquid and nethserver-squid

1 Like

Could you please post the output of

db squid show

It seems there is an error in the squid db.

The error occurs when getting the squid rule entries:

$max = max(array_keys($db->getAll('rule')));

1 Like

db squid show doesn’t show anything, also I don’t have any rule set it, right now.

Confirmed. I get the same error when modifying proxy. I must have been looking on a wrong server…

I think the error does no harm and a fix is more or less cosmetic and main focus is on cockpit now.

Because there are no proxy rules, the array is empty and that throws the error.
I added a check and the error seems to not occur anymore but I didn’t test much and don’t know if that change has other negative impacts.

I edited /usr/share/nethesis/NethServer/Module/Proxy/Rules/Modify.php:

Line 129:

    private function nextKey()
    {
        $db = $this->getPlatform()->getDatabase('squid');
        $array = array_keys($db->getAll('rule'));
        if(!empty($array)) $max = max($array);
        return $max+1;
    }
3 Likes