I am developing a Grav site and it has been working perfectly on my localhost and usually works well on my host (Wirenine). A few times now upon logging into the admin panel I would get an error that looked like this:
Whoops\Exception\ErrorException thrown with message "Call to a member function content() on null"
Stacktrace:
#0 in /home/ffcmsbiz/public_html/vintagemoto.ca/system/src/Grav/Common/Twig/ Twig.php:300
Open: /home/ffcmsbiz/public_html/vintagemoto.ca/system/src/Grav/Common/Twig/ Twig.php
*/
public function processSite($format = null)
{
// set the page now its been processed
$this->grav->fireEvent('onTwigSiteVariables');
$pages = $this->grav['pages'];
$page = $this->grav['page'];
$content = $page->content();
$config = $this->grav['config'];
I have several sites on Wirenine and two of them had this error, three of them were fine. After much trial and error I finally got logged in by deleting my user/admin.yaml file and creating a new user from command line: bin/plugin login new-user
. After that I was able to get logged in and everything is just fine. I am not sure why this happened, I did notice that the create user process has been updated adding an enabled or disabled switch. This has happened intermittently on two different sites for a week or so now. It is working fine now so I hope this helps anybody that comes across it.