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

Fatal Error Call to a member function rollback() on null #18

Closed
bloomfieldcollege opened this issue Jul 2, 2019 · 3 comments · Fixed by #19
Closed

Fatal Error Call to a member function rollback() on null #18

bloomfieldcollege opened this issue Jul 2, 2019 · 3 comments · Fixed by #19
Labels

Comments

@bloomfieldcollege
Copy link

Hi,

I hope this is the right place to post this, and if it's not, I apologize. I'm getting this error:

PHP Fatal error: Uncaught Error: Call to a member function rollback() on null in /drupalpath/vendor/drupal-composer/info-rewrite/src/DrupalInfo.php:138
Stack trace:
#0 /drupalpath/vendor/drupal-composer/info-rewrite/src/DrupalInfo.php(111): DrupalComposer\Composer\DrupalInfo->doRollback(Object(Composer\Package\AliasPackage))
#1 [internal function]: DrupalComposer\Composer\DrupalInfo->rollbackRewrite(Object(Composer\Script\Event))
#2 phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Script\Event))
#3 phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#4 phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/Installer.php(205): Composer\EventDispatcher\EventDispatcher->dispatchScript('pre-update-cmd', true) in /drupalpath/vendor/drupal-composer/info-rewrite/src/DrupalInfo.php on line 138

Fatal error: Uncaught Error: Call to a member function rollback() on null in /drupalpath/vendor/drupal-composer/info-rewrite/src/DrupalInfo.php:138
Stack trace:
#0 /drupalpath/vendor/drupal-composer/info-rewrite/src/DrupalInfo.php(111): DrupalComposer\Composer\DrupalInfo->doRollback(Object(Composer\Package\AliasPackage))
#1 [internal function]: DrupalComposer\Composer\DrupalInfo->rollbackRewrite(Object(Composer\Script\Event))
#2 phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Script\Event))
#3 phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#4 phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/Installer.php(205): Composer\EventDispatcher\EventDispatcher->dispatchScript('pre-update-cmd', true) in /drupalpath/vendor/drupal-composer/info-rewrite/src/DrupalInfo.php on line 138

I'm not sure what to do.

@jhedstrom
Copy link
Collaborator

To fix the immediate error you could just remove the module (or theme) and then run composer install--this error is happening on rollback for some reason. We could probably harden the logic around the error here:

    /**
     * Process an info file rollback for a given package.
     * @param PackageInterface $package
     */
    protected function doRollback(PackageInterface $package)
    {
        $writer = $this->getWriter($package);
        $writer->rollback();
    }

for whatever reason, a corresponding write class isn't being found, thus the fatal error. So that above logic could throw a better exception/error with relevant details, or just log the error as a warning and allow composer to continue on.

@jhedstrom
Copy link
Collaborator

Thanks for the report! This should be fixed in the latest version now.

@RishiKulshreshtha
Copy link

This was reported while using Composer version 1.10.5 2020-04-10 11:44:22.

Though it got bypassed once I removed/deleted the vendor directory and executed the composer install command.

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

Successfully merging a pull request may close this issue.

3 participants