From 2e9d4c45232c596300c125775c3e86df0a131d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 19 Oct 2024 16:58:54 +0200 Subject: [PATCH] Fix passing null to strpos in gatherpress transformer (#69) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://code.event-federation.eu/Event-Federation/wordpress-activitypub-event-bridge/pulls/69 Co-authored-by: André Menrath Co-committed-by: André Menrath --- composer.json | 2 +- includes/activitypub/transformer/class-gatherpress.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index eaf1ea5..6236dfc 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,7 @@ ], "test-debug": [ "@prepare-test", - "@test-modern-events-calendar-lite" + "@test-gatherpress" ], "test-vs-event-list": "phpunit --filter=vs_event_list", "test-the-events-calendar": "phpunit --filter=the_events_calendar", diff --git a/includes/activitypub/transformer/class-gatherpress.php b/includes/activitypub/transformer/class-gatherpress.php index b67bc58..756524a 100644 --- a/includes/activitypub/transformer/class-gatherpress.php +++ b/includes/activitypub/transformer/class-gatherpress.php @@ -124,7 +124,7 @@ final class GatherPress extends Event { */ public static function filter_gatherpress_blocks( $block_content, $block ) { // Check if the block name starts with 'gatherpress'. - if ( strpos( $block['blockName'], 'gatherpress/' ) === 0 ) { + if ( isset( $block['blockName'] ) && 0 === strpos( $block['blockName'], 'gatherpress/' ) ) { return ''; // Skip rendering this block. }