You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using { "extra": { "merge-plugin": { "include": [ "extensions/*/composer.json" ] } } sometimes gives error of the form
Fatal error: Cannot redeclare <some function/class> (previously declared in <directory>/extensions/<name>/<file>:<line>) in <directory>/extensions/<name>/<file> on line <line>
when optimize-autoloader is true. EDIT: Also when optimize-autoloader is false.
I stripped down my MW-installation to the following MWE to demonstrate the issue:
<?phpdefine('MEDIAWIKI', '1.35');
define('NS_MEDIAWIKI', 2);
require_once__DIR__ . '/vendor/autoload.php';
echo"When this is shown, the page is working";
With these files set up, reproduce the issue as follows:
Run composer updatetwice.
Either run php -S localhost:8000 and then go to localhost:8000 in your browser, or just run php index.php.
When you run composer update once, everything works, but when done twice it does not.
In this case the files ./vendor/composer/autoload_static.php and ./vendor/composer/autoload_files.php look something like
Well I got exactly the same error here. I temporarily resolved in my conposer (version 2) to add the require_once and that way I temporarily solved the problem. However, I think Wikimedia has this problem.
Using
{ "extra": { "merge-plugin": { "include": [ "extensions/*/composer.json" ] } }
sometimes gives error of the formwhen
optimize-autoloader
istrue
. EDIT: Also whenoptimize-autoloader
isfalse
.I stripped down my MW-installation to the following MWE to demonstrate the issue:
EDIT: Here is an even more minimal example:
composer.json
:test-dependency/composer.json
:test-dependency/Test.php
:END OF EDIT
composer.json
:composer.local.json
:index.php
:With these files set up, reproduce the issue as follows:
composer update
twice.php -S localhost:8000
and then go tolocalhost:8000
in your browser, or just runphp index.php
.When you run
composer update
once, everything works, but when done twice it does not.In this case the files
./vendor/composer/autoload_static.php
and./vendor/composer/autoload_files.php
look something likeand
respectively.
This forces composer to load these files two times, resulting in the error described above.
I use
php
version7.4.30
andcomposer
version2.4.1
.The text was updated successfully, but these errors were encountered: