Skip to content
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

8.6.1 introduces fatal error when using composer autoloader for a site #16399

Closed
JPry opened this issue Jul 4, 2020 · 1 comment
Closed

8.6.1 introduces fatal error when using composer autoloader for a site #16399

JPry opened this issue Jul 4, 2020 · 1 comment
Labels
Build [Focus] Jetpack DNA [Type] Bug When a feature is broken and / or not performing as intended

Comments

@JPry
Copy link

JPry commented Jul 4, 2020

When installing Jetpack using Composer, a fatal error is triggered when attempting to load a site:

PHP Fatal error:  Uncaught Error: Call to undefined function add_action() in /Users/jpry/Sites/jetpack-test/content/vendor/automattic/jetpack-backup/actions.php:13
Stack trace:
#0 /Users/jpry/Sites/jetpack-test/content/vendor/composer/autoload_real.php(69): require()
#1 /Users/jpry/Sites/jetpack-test/content/vendor/composer/autoload_real.php(59): composerRequire39832e96936c87813e67c175b71e54ff('d4eb94df91a7298...', '/Users/jpry/Sit...')
#2 /Users/jpry/Sites/jetpack-test/content/vendor/autoload.php(7): ComposerAutoloaderInit39832e96936c87813e67c175b71e54ff::getLoader()
#3 /Users/jpry/Sites/jetpack-test/wp-config.php(16): require_once('/Users/jpry/Sit...')
#4 /Users/jpry/Sites/jetpack-test/wp/wp-load.php(42): require_once('/Users/jpry/Sit...')
#5 /Users/jpry/Sites/jetpack-test/wp/wp-blog-header.php(13): require_once('/Users/jpry/Sit...')
#6 /Users/jpry/Sites/jetpack-test/index.php(17): require('/Users/jpry/Sit...')
#7 /Users/jpry/.composer/vendor/weprovide/valet-plus/server.php(131): require('/Users/jpry/Sit...')
#8 {main}
  thr in /Users/jpry/Sites/jetpack-test/content/vendor/automattic/jetpack-backup/actions.php on line 13

Steps to reproduce the issue

Set up a site that uses composer to build the site. I happened to use WP Starter, and this is what my composer.json file looks like:

{
    "name": "jpry/jetpack-test",
    "type": "project",
    "require": {
        "php": "^7.3",
        "automattic/jetpack": "8.6.1",
        "composer/installers": "^1.9",
        "wecodemore/wpstarter": "^2.4"
    },
    "config": {
        "sort-packages": true,
        "vendor-dir": "content/vendor",
        "platform": {
            "php": "7.3"
        }
    },
    "scripts": {
        "post-install-cmd": [
            "@setup"
        ],
        "post-update-cmd": [
            "@setup"
        ],
        "setup": [
            "WCM\\WPStarter\\Setup::run"
        ]
    },
    "extra": {
        "wordpress-install-dir": "wp",
        "wordpress-content-dir": "content",
        "installer-paths": {
            "content/plugins/{$name}": [
                "type:wordpress-plugin"
            ],
            "content/mu-plugins/{$name}": [
                "type:wordpress-muplugin"
            ],
            "content/themes/{$name}": [
                "type:wordpress-theme"
            ]
        }
    }
}

When attempting to load the site, even if the Jetpack plugin is not active, a fatal error will occur. If the version of Jetpack included in the composer.json is set to 8.6, then the fatal error will not occur.

I suspect this has to do with the additions to Jetpack's composer.json file in version 8.6.1.

@JPry JPry added [Type] Bug When a feature is broken and / or not performing as intended Backwards Compatibility labels Jul 4, 2020
@jeherve
Copy link
Member

jeherve commented Jul 6, 2020

That's indeed a known issue. It was previously brought up in #13497. We fixed the problem with a change to our building tools in #14900, but for some reason we still don't understand, that didn't work out for the past release:
e0fde56#r39872402

It will be okay for 8.7 though, scheduled to be released tomorrow:
https://github.com/Automattic/jetpack/blob/branch-8.7-built/composer.json#L10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build [Focus] Jetpack DNA [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

No branches or pull requests

2 participants