Skip to content

Commit

Permalink
Sharing: be more defensive in sharing output to avoid warnings
Browse files Browse the repository at this point in the history
Fixes #40338
  • Loading branch information
jeherve committed Nov 26, 2024
1 parent f55374c commit 9498f26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/fix-sharing-module-warning
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

Sharing: avoid PHP warnings when customizing the output of the sharing buttons.
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,10 @@ function_exists( '\Activitypub\is_activitypub_request' )
*/
$sharing_markup = apply_filters( 'jetpack_sharing_display_markup', $sharing_content, $enabled );

if ( ! is_string( $sharing_markup ) || ! is_string( $text ) ) {
return $text;
}
l( $text, $sharing_markup );
if ( $echo ) {
echo $text . $sharing_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
Expand Down

0 comments on commit 9498f26

Please sign in to comment.