0

I'm facing issue while accessing my froxlor resource options it return me 500. After checking logs seems like its froxlor files issue but it was working fine before updating. Can someone please help me to fix this issue.

Following are the logs that i get from logs file

==> error.log <== [Fri Dec 11 14:28:24.561001 2020] [:error] [pid 17164] [client xxx.x.x.x:56339] PHP Parse error: syntax error, unexpected '?' in /var/www/html/froxlor/lib/Froxlor/Api/ApiCommand.php on line 288, referer: https://domainname.de/froxlor/admin_index.php?s=e1f085be86e266d74ae77d82e88ec08b

==> access.log <== xxx.x.x.x - - [11/Dec/2020:14:28:24 +0100] "GET /froxlor/admin_admins.php?page=admins&s=e1f085be86e266d74ae77d82e88ec08b HTTP/1.1" 500 5390 "https://domainname.de/froxlor/admin_index.php?s=e1f085be86e266d74ae77d82e88ec08b" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36 OPR/72.0.3815.320"

There is the code

if (! is_array($valoper) || ! isset($valoper['op']) || empty($valoper['op'])) {
    $condition .= $field . ' LIKE :' . $cleanfield;
    if (! is_array($valoper)) {
        $query_fields[':' . $cleanfield] = '%' . $valoper . '%';
    } else {
        $query_fields[':' . $cleanfield] = '%' . $valoper['value'] . '%';
    }
} elseif (in_array($valoper['op'], $ops)) {
    $condition .= $field . ' ' . $valoper['op'] . ':' . $cleanfield;
    //=====>Line288
    $query_fields[':' . $cleanfield] = $valoper['value'] ?? '';
} else {
    continue;
}
if ($first) {
    $first = false;
}

Slava Rozhnev
  • 9,510
  • 6
  • 23
  • 39
M. H
  • 1
  • 2

1 Answers1

0

I guess this error trowed by Null Coalescing Operator. This operator introduced in PHP 7.0 . In PHP 5.x.x you need to use isset() within ternary operator :

$query_fields[':' . $cleanfield] = isset($valoper['value']) ? $valoper['value'] : '';
Slava Rozhnev
  • 9,510
  • 6
  • 23
  • 39