Skip to content

Commit

Permalink
fix: conflicts when autoloading files
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Jan 17, 2025
1 parent bd92c80 commit 7d6bbc2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"php": "8.0"
},
"optimize-autoloader": true,
"classmap-authoritative": true
"classmap-authoritative": true,
"autoloader-suffix": "WWTFWA"
},
"extra": {
"imposter": {
Expand All @@ -56,6 +57,9 @@
"Fix client extension verification (GH-295)": "patches/client-extensions.patch",
"Fix EdDSA keys/improve YubiKey support": "patches/gh-541.patch",
"Fix Firefox iCloud support": "patches/webauthn-icloud.patch"
},
"guzzlehttp/guzzle": {
"Fix namespace in check": "patches/guzzle.patch"
}
}
},
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
use WildWolf\WordPress\TwoFactorWebAuthn\Plugin;

if ( defined( 'ABSPATH' ) ) {
/** @var mixed */
$save = $GLOBALS['__composer_autoload_files'] ?? null;

/** @var ClassLoader */
$loader = require __DIR__ . '/vendor/autoload.php'; // NOSONAR
$loader->addClassMap( [
WP_List_Table::class => ABSPATH . 'wp-admin/includes/class-wp-list-table.php',
] );

/** @psalm-suppress MixedAssignment */
$GLOBALS['__composer_autoload_files'] = $save;

if ( ! defined( 'WP_INSTALLING' ) || ! WP_INSTALLING ) {
Plugin::instance();
}
Expand Down
10 changes: 10 additions & 0 deletions patches/guzzle.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- src/functions_include.php 2025-01-17 11:39:43.072206414 +0200
+++ src/functions_include.php 2025-01-17 11:40:14.455385052 +0200
@@ -1,6 +1,6 @@
<?php

// Don't redefine the functions if included multiple times.
-if (!\function_exists('GuzzleHttp\describe_type')) {
+if (!\function_exists('\\WildWolf\\WordPress\\TwoFactorWebAuthn\\Vendor\\GuzzleHttp\\describe_type')) {
require __DIR__.'/functions.php';
}

0 comments on commit 7d6bbc2

Please sign in to comment.