Skip to content

Commit 5bee824

Browse files
committed
Add stricter checks for the capabilities input
1 parent 602299d commit 5bee824

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

utils/class-capability-utils.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static function user_has_any_capability_full( $user, $capabilities ): boo
8383

8484
try {
8585
foreach ( $capabilities as $capability ) {
86-
if ( ! is_scalar( $capability ) ) {
86+
if ( ! is_string( $capability ) || trim( $capability ) === '' ) {
8787
continue;
8888
}
8989

@@ -129,7 +129,7 @@ public static function user_has_any_capability( $user, $capabilities ): bool {
129129

130130
foreach ( $capabilities as $capability ) {
131131
// Skip non-scalar capabilities to prevent errors
132-
if ( ! is_scalar( $capability ) ) {
132+
if ( ! is_string( $capability ) || trim( $capability ) === '' ) {
133133
continue;
134134
}
135135

0 commit comments

Comments
 (0)