Merge pull request #139 from edeckers/elydeckers/fix/broken-variable-initializations-php-8-1

Fix broken variable initializations php 8.1
This commit is contained in:
Riccardo 2023-05-17 17:47:03 +02:00 committed by GitHub
commit f419ca46e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -155,7 +155,7 @@ function pfz_interface_speedtest_value($ifname, $value){
$filename = "/tmp/speedtest-$ifname";
if (file_exists($filename)) {
$speedtest_data = json_decode(file_get_contents($filename), true);
$speedtest_data = json_decode(file_get_contents($filename), true) ?? [];
if (array_key_exists($value, $speedtest_data)) {
if ($subvalue == false)
@ -859,6 +859,13 @@ function pfz_dhcp_get($valuekey) {
$leases_count = count($leases_content);
@exec("/usr/sbin/arp -an", $rawdata);
$leases = [];
$pools = [];
$i = 0;
$l = 0;
$p = 0;
foreach ($leases_content as $lease) {
/* split the line by space */
$data = explode(" ", $lease);

View File

@ -671,7 +671,7 @@ class SpeedTest
return Util::result("");
}
$speed_test_data = json_decode(file_get_contents($filename), true);
$speed_test_data = json_decode(file_get_contents($filename), true) ?? [];
if (!array_key_exists($value, $speed_test_data)) {
return Util::result("");
}