Autoloader: more precise matching (#372)

This commit is contained in:
Matt Wiebe 2023-07-26 17:46:36 -05:00 committed by GitHub
parent 5b9dadd6fd
commit 1020466756
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 );