From bf883418ecf702fbfae0f531ad899be67accc386 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sat, 10 Dec 2022 17:58:24 +0100 Subject: [PATCH] fix #214 thanks @mexon --- README.md | 4 ++++ activitypub.php | 2 +- includes/rest/class-webfinger.php | 4 +--- readme.txt | 4 ++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cebb96f..2fce62b 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,10 @@ Where 'blog' is the path to the subdirectory at which your blog resides. Project maintained on GitHub at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). +### 0.14.1 ### + +* Fix "WebFinger not compatible with PHP < 8.0". props [@mexon](https://github.com/mexon) + ### 0.14.0 ### * Friends support: https://wordpress.org/plugins/friends/ props [@akirk](https://github.com/akirk) diff --git a/activitypub.php b/activitypub.php index 462ae28..845c0fe 100644 --- a/activitypub.php +++ b/activitypub.php @@ -3,7 +3,7 @@ * Plugin Name: ActivityPub * Plugin URI: https://github.com/pfefferle/wordpress-activitypub/ * Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format. - * Version: 0.14.0 + * Version: 0.14.1 * Author: Matthias Pfefferle * Author URI: https://notiz.blog/ * License: MIT diff --git a/includes/rest/class-webfinger.php b/includes/rest/class-webfinger.php index 60eb5d2..dc84da4 100644 --- a/includes/rest/class-webfinger.php +++ b/includes/rest/class-webfinger.php @@ -44,9 +44,7 @@ class Webfinger { public static function webfinger( $request ) { $resource = $request->get_param( 'resource' ); - $matched = \str_contains( $resource, '@' ); - - if ( ! $matched ) { + if ( \strpos( $resource, '@' ) === false ) { return new \WP_Error( 'activitypub_unsupported_resource', \__( 'Resource is invalid', 'activitypub' ), array( 'status' => 400 ) ); } diff --git a/readme.txt b/readme.txt index a9b048d..797c334 100644 --- a/readme.txt +++ b/readme.txt @@ -88,6 +88,10 @@ Where 'blog' is the path to the subdirectory at which your blog resides. Project maintained on GitHub at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). += 0.14.1 = + +* Fix "WebFinger not compatible with PHP < 8.0". props [@mexon](https://github.com/mexon) + = 0.14.0 = * Friends support: https://wordpress.org/plugins/friends/ props [@akirk](https://github.com/akirk)