hardening: modernize string comparisons with PHP 8 functions (#6863) (#6864)

This commit is contained in:
Thomas Vincent authored and GitHub committed 2026-03-23 13:08:45 -04:00
1 parent 61d8e93592
commit 67a596dea6
3 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -193,7 +193,7 @@ function get_timespan(array &$span, int $curr_time, int $timespan_given, int $fi
*/
function month_shift(string $shift_size) : bool {
// is monthly shifting required?
return (strpos(cacti_strtolower($shift_size), 'month') !== false);
return (str_contains(cacti_strtolower($shift_size), 'month'));
}
/**
+2 -2
View File
@@ -1683,7 +1683,7 @@ function user_realms_edit(string $header_label) : void {
$local_user_auth_realms = __($user_auth_realms[$realm], $r['directory']);
$pos = (strpos($local_user_auth_realms, '->') !== false ? strpos($local_user_auth_realms, '->') + 2 : 0);
$pos = (str_contains($local_user_auth_realms, '->') ? strpos($local_user_auth_realms, '->') + 2 : 0);
if ($i == 0) {
print "<tr class='tableHeader'><th class='left' colspan='2'>" . __('Plugin Permissions') . '</th></tr>';
@@ -1718,7 +1718,7 @@ function user_realms_edit(string $header_label) : void {
$old_value = '';
}
$pos = (strpos($user_auth_realms[$realm], '->') !== false ? strpos($user_auth_realms[$realm], '->') + 2 : 0);
$pos = (str_contains($user_auth_realms[$realm], '->') ? strpos($user_auth_realms[$realm], '->') + 2 : 0);
print '<div class="flexChild">';
form_checkbox('section' . $realm, $old_value, substr($user_auth_realms[$realm], $pos), '', '', '', '', $name, true);
+2 -2
View File
@@ -1546,7 +1546,7 @@ function user_group_realms_edit(string $header_label) : void {
unset($all_realms[$realm]);
$pos = (strpos($user_auth_realms[$realm], '->') !== false ? strpos($user_auth_realms[$realm], '->') + 2 : 0);
$pos = (str_contains($user_auth_realms[$realm], '->') ? strpos($user_auth_realms[$realm], '->') + 2 : 0);
if ($i == 0) {
print "<tr class='tableHeader'><th colspan='2'>" . __('Plugin Permissions') . '</th></tr>';
@@ -1582,7 +1582,7 @@ function user_group_realms_edit(string $header_label) : void {
$old_value = '';
}
$pos = (strpos($user_auth_realms[$realm], '->') !== false ? strpos($user_auth_realms[$realm], '->') + 2 : 0);
$pos = (str_contains($user_auth_realms[$realm], '->') ? strpos($user_auth_realms[$realm], '->') + 2 : 0);
print '<div class="flexChild">';
form_checkbox('section' . $realm, $old_value, substr($user_auth_realms[$realm], $pos), '', '', '', '', $name, true);