Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prevent PHP errors when iterating network interfaces
glob() might return false, causing "foreach() argument must be of type array|object, bool given" PHP errors

Signed-off-by: Daniel Rudolf <[email protected]>
  • Loading branch information
PhrozenByte committed May 21, 2022
commit 57da9d82b651ead9fd1d396b84766d2df82d5bcc
2 changes: 1 addition & 1 deletion lib/OperatingSystems/DefaultOs.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function getNetworkInfo(): array {
}

public function getNetworkInterfaces(): array {
$interfaces = glob('/sys/class/net/*');
$interfaces = glob('/sys/class/net/*') ?: [];
$result = [];

foreach ($interfaces as $interface) {
Expand Down