Skip to content

🐞 Bug Report: Can't install using Composer because of missing composer.json in GitHub tag ZIPs #505

@kasparsd

Description

@kasparsd

Detailed Description

We're currently excluding composer.json and composer.lock from the git archives (which are used by GitHub tag releases) by setting the following in .gitattributes:

composer.json export-ignore
composer.lock export-ignore

Expected Behavior

Users should be able to add this plugin by register this GitHub repository as a Composer repository in their composer.json:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/fairpm/fair-plugin"
        }
    ],
    "require": {
        "fairpm/fair-plugin": "^1.4"
    }
}

which then pulls in the required plugin dependencies required for the functioning of the plugin. At least until we isolate and include in the releases #498.

Current Behavior

The composer require fairpm/fair-plugin step works but on plugin activation users get:

Warning: require_once(/var/www/html/wp-content/plugins/fair-plugin/vendor/autoload.php): Failed to open stream: No such file or directory in /var/www/html/wp-content/plugins/fair-plugin/plugin.php on line 28 Fatal error: Uncaught Error: Failed opening required '/var/www/html/wp-content/plugins/fair-plugin/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/html/wp-content/plugins/fair-plugin/plugin.php:28 Stack trace: #0 /var/www/html/wp-settings.php(589): include_once() #1 /var/www/html/wp-config.php(150): require_once('/var/www/html/w...') #2 /var/www/html/wp-load.php(50): require_once('/var/www/html/w...') #3 /var/www/html/wp-admin/admin.php(35): require_once('/var/www/html/w...') #4 /var/www/html/wp-admin/plugins.php(10): require_once('/var/www/html/w...') #5 {main} thrown in /var/www/html/wp-content/plugins/fair-plugin/plugin.php on line 28 

because:

  1. we're requiring vendor/autoload.php in the plugin bootstrap file,
  2. the composer.json and composer.lock are missing from the releases and fairpm/did-manager-wordpress dependency isn't therefore installed.

Steps to Reproduce

  1. See above.

Context (Environment)

  • FAIR connect 1.4.0 and earlier versions.

Possible Solution

  1. Include composer.json and composer.lock in git archives by updating .gitattributes.
  2. Load vendor/autoload.php only if it exists.

Possible Implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions