From 1020466756df25e61ca0a7661ba69bd45f9c657d Mon Sep 17 00:00:00 2001 From: Matt Wiebe Date: Wed, 26 Jul 2023 17:46:36 -0500 Subject: [PATCH] Autoloader: more precise matching (#372) --- activitypub.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/activitypub.php b/activitypub.php index a8d3a94..300b500 100644 --- a/activitypub.php +++ b/activitypub.php @@ -64,12 +64,10 @@ function init() { spl_autoload_register( function ( $full_class ) { $base_dir = __DIR__ . '/includes/'; - $base = 'activitypub'; + $base = 'Activitypub\\'; - $class = strtolower( $full_class ); - - if ( strncmp( $class, $base, strlen( $base ) ) === 0 ) { - $class = str_replace( 'activitypub\\', '', $class ); + if ( strncmp( $full_class, $base, strlen( $base ) ) === 0 ) { + $class = strtolower( str_replace( $base, '', $full_class ) ); if ( false !== strpos( $class, '\\' ) ) { $parts = explode( '\\', $class );