Skip to content

Commit

Permalink
Merge pull request #483 from edent/patch-4
Browse files Browse the repository at this point in the history
Update class-mf2.php to flatten the haystack
  • Loading branch information
pfefferle authored Jul 16, 2024
2 parents e3ceda3 + 99ba7d1 commit 35d2f90
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions includes/Handler/class-mf2.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,14 @@ public function compare_urls( $needle, $haystack, $schemeless = true ) {
$needle = array( $needle );
}

// Flatten the haystack to ensure it only contains strings
$haystack = array_filter(
$haystack,
function ( $element ) {
return is_string( $element ) && ! is_array( $element );
}
);

// Compare both arrays.
return array_intersect( $needle, $haystack );
}
Expand Down

0 comments on commit 35d2f90

Please sign in to comment.