Old Grav installation crashes on startup, how to update?

Returning to a Grav site I last used in 2019 I get this error: Whoops \ Exception \ ErrorException (E_DEPRECATED)
Unparenthesized a ? b : c ? d : e is deprecated. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e)

The error report says the offence is in /home/tgworksh/public_html/grav6/vendor/twig/twig/src/Node/Node.php

Looks like I need to update Grav. But the update system is only available after logging in, and I can’t log in because of the error.

How should I proceed?

First of all, backup your grav6 folder.
Download Grav and upload the contents to that grav6 without the user folder (user folder contains all your themes, plugins and settings, so try keeping the original contents)
Most likely your old theme will also not work, because of the changes in newer Grav version. If that will be the case, you can try the second option from this post:

Or you can add the following settings to system.yaml to disable auto-escaping:

  autoescape: false
  twig_compat: true

Success. Thank you Karmalakas



Would you mind sharing what exactly solved your issue? Installing a fresh Grav, or updating the Twig compatibility settings?

I installed a fresh Grav and renamed the ‘user’ folder to ‘userX’. Then I copied the user folder over from the non-working version, and all went well. To my relief.

1 Like