Skip to content

Composer gives an error pointing to SemanticCite when trying to update it #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vapblack opened this issue Jun 26, 2024 · 1 comment

Comments

@vapblack
Copy link

Setup and configuration

  • SMW version: 4.1.3
  • SCI version: ?? What's SCI?
  • MW version: 1.41.1
  • DB (MySQL etc. and version): 10.5.22-MariaDB, php 8.0.30 (fpm-fcgi), mysql Ver 15.1

Issue

I'm trying to install wikibase using composer

Produces a stack trace and outputs:

Steps to reproduce the observation (recommendation is to use the sandbox):

When I run this command:

composer update --no-dev -vvv

I get the following output:

Running 2.7.7 (2024-06-10 22:11:12) with PHP 8.0.30 on Linux / 5.14.0-427.18.1.el9_4.x86_64
Reading ./composer.json (/var/www/html/afropedia/composer.json)
Loading config file ./composer.json (/var/www/html/afropedia/composer.json)
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Failed to initialize global composer: Composer could not find the config file: /home/vap/.config/composer/composer.json

Reading /var/www/html/afropedia/vendor/composer/installed.json
Loading plugin Composer\Installers\Plugin (from composer/installers)
Loading plugin Wikimedia\Composer\Merge\V2\MergePlugin (from wikimedia/composer-merge-plugin)
> init: Wikimedia\Composer\Merge\V2\MergePlugin->onInit
  [merge-plugin] Loading composer.local.json...
  [merge-plugin] Adding mediawiki/sub-page-list
  [merge-plugin] Adding mediawiki/semantic-media-wiki
  [merge-plugin] Adding mediawiki/semantic-cite
> pre-update-cmd: Wikimedia\Composer\Merge\V2\MergePlugin->onInstallUpdateOrDump
  [merge-plugin] Already merged composer.local.json completely
> pre-update-cmd: ComposerHookHandler::onPreUpdate
This file is part of the SemanticCite extension, it is not a valid entry point.

I asked in the composer github page, and I was directed here, since the error points to SemanticCite as a culprit.

@evrydayjunglist
Copy link

evrydayjunglist commented Apr 4, 2025

Not sure if this is the correct way to handle it, but I added this around the SemanticCite::load() call in SemanticCite.php to avoid issues during Composer updates:

// Avoid autoload execution during Composer install/update
if (PHP_SAPI !== 'cli' || !in_array(basename($_SERVER['argv'][0] ?? ''), ['composer', 'composer.phar'])) {
    SemanticCite::load();
}

This stopped the "not a valid entry point" error from showing up during composer update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants