Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Ambiguous class resolution for"watchfulli\XClonerCore\Xcloner" #3

Open
Shelob9 opened this issue Jan 19, 2022 · 2 comments
Open

Ambiguous class resolution for"watchfulli\XClonerCore\Xcloner" #3

Shelob9 opened this issue Jan 19, 2022 · 2 comments
Assignees

Comments

@Shelob9
Copy link

Shelob9 commented Jan 19, 2022

When installing composer dependencies in the plugin, with composer v1 -

Warning: Ambiguous class resolution, "watchfulli\XClonerCore\Xcloner" was found in both "/home/demos/webapps/wpdemo/public/32/wp-content/plugins/XCloner-Wordpress/vendor/watchfulli/xcloner-core/src/Xcloner_Encryption.php" and "/home/demos/webapps/wpdemo/public/32/wp-content/plugins/XCloner-Wordpress/vendor/watchfulli/xcloner-core/src/Xcloner.php", the first will be used.

I have confirmed this leads to fatal errors when plugin is built with composer 2.0 or later.

Related #2 and watchfulli/XCloner-Wordpress#189

@Shelob9
Copy link
Author

Shelob9 commented Jan 19, 2022

  • Class is created for a second time here: https://github.com/watchfulli/xcloner-core/blob/master/src/Xcloner_Encryption.php#L384
  • Created in this commit: 5d581af
  • Based on how I am reading the plugin -- I am new to this code -- I see two ways src/Xcloner_Encryption.php may be used.
    • In the main plugin file, it is used to encrypt and decrypt backups.
    • The examples directory shows how to call it using PHP, not using WordPress, in order to encrypt or decrypt a backup. In this use case, the autoloader isn't included, so Xcloner doesn't already exist.

The solution is probably to use require_once the autoloader in place of double declaring the class. That probably will not break anything.

@Shelob9
Copy link
Author

Shelob9 commented Jan 19, 2022

I am testing this branch in the plugin. Original issues are fixed. I get this though:

Class Watchfulli\XClonerCore\Index located in ./vendor/watchfulli/xcloner-core/src/index.php does not comply with psr-4 autoloading standard. Skipping.

Shelob9 added a commit that referenced this issue Jan 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant