cast to bool, to be sure that '0' is false

This commit is contained in:
Matthias Pfefferle 2023-05-09 12:25:25 +02:00
parent b88c5f606d
commit ca8aff1823
2 changed files with 2 additions and 2 deletions

View file

@ -78,7 +78,7 @@ class Activitypub {
\in_array( 'application/ld+json', $accept, true ) || \in_array( 'application/ld+json', $accept, true ) ||
\in_array( 'application/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 ) { if ( $secure_mode ) {
$verification = Signature::verify_http_signature( $_SERVER ); $verification = Signature::verify_http_signature( $_SERVER );
if ( \is_wp_error( $verification ) ) { if ( \is_wp_error( $verification ) ) {

View file

@ -92,7 +92,7 @@ class Server {
} else { } else {
if ( '/activitypub/1.0/webfinger' !== $route ) { if ( '/activitypub/1.0/webfinger' !== $route ) {
// SecureMode/Authorized fetch. // 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 ) { if ( $secure_mode ) {
$verified_request = Signature::verify_http_signature( $request ); $verified_request = Signature::verify_http_signature( $request );
if ( \is_wp_error( $verified_request ) ) { if ( \is_wp_error( $verified_request ) ) {