From ca8aff182350b57561f5868c583bd7d6bc326cd4 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Tue, 9 May 2023 12:25:25 +0200 Subject: [PATCH] cast to bool, to be sure that '0' is false --- includes/class-activitypub.php | 2 +- includes/rest/class-server.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php index c0695a9..6e79fa6 100644 --- a/includes/class-activitypub.php +++ b/includes/class-activitypub.php @@ -78,7 +78,7 @@ class Activitypub { \in_array( 'application/ld+json', $accept, true ) || \in_array( 'application/json', $accept, true ) ) { - $secure_mode = \get_option( 'activitypub_use_secure_mode', '0' ); + $secure_mode = (bool) \get_option( 'activitypub_use_secure_mode', '0' ); if ( $secure_mode ) { $verification = Signature::verify_http_signature( $_SERVER ); if ( \is_wp_error( $verification ) ) { diff --git a/includes/rest/class-server.php b/includes/rest/class-server.php index 8deac10..712a3af 100644 --- a/includes/rest/class-server.php +++ b/includes/rest/class-server.php @@ -92,7 +92,7 @@ class Server { } else { if ( '/activitypub/1.0/webfinger' !== $route ) { // SecureMode/Authorized fetch. - $secure_mode = \get_option( 'activitypub_use_secure_mode', '0' ); + $secure_mode = (bool) \get_option( 'activitypub_use_secure_mode', '0' ); if ( $secure_mode ) { $verified_request = Signature::verify_http_signature( $request ); if ( \is_wp_error( $verified_request ) ) {