Fatal error: Uncaught TypeError: Return value of Wcms::getDb() must be an instance of stdClass, null returned in [web directory]/index.php:543 Stack trace: #0 [web directory]/index.php(92): Wcms->getDb() #1 [web directory]/index.php(14): Wcms->__construct() #2 {main} thrown in [web directory]/index.php on line 543
Hosting running Apache, PHP 7.2 (ea-php72). I use the Clean theme.
Hi jbwonderadmin, hope you have a warm welcome to the community.
In regards to the report, this is the third reported occurence after 3.1.0 rolled out.
It seems all updates go through normally and the website works, then after logging in after a few days the database gets corrupted.
We're looking into this.
Is there any plugins you have been using. If so, which ones?
Thank you for the report, it helps debug these issues faster.
Interesting. I updated to 3.1.0 and last touched the site on June 22. database.js is indeed empty, last modified July 4. Thankfully I have the 2.7.0 database.js backed up so the content is safe.
I don't think I am using any plugins.
Apologies if this was duplicative. I didn't see a topic on this issue in this forum.
Any report and feedback is appreciated and there hasn't been any topic on the matter, you're awesome!
Was your database.js file empty or was there anything inside of it when it was corrupted?
To check if you're using plugins, log into your website, open the settings and click on the plugins tab. If there are any plugins installed you will be able to see then.
Another way to check is to simply open your "plugins" folder on your server and see if it's empty.
The database.js file still exists but is now 0 bytes. I don't know if there was some intermediate point where it had been corrupted but not yet wiped. There was data for a whole functioning site, maybe 10 pages or so, in the database.js file and the site had been displaying/behaving correctly when initially set up and for at least a few days after.
The plugins directory is empty and I never installed any that I can recall.
Hopefully the latest pull request (still pending) will prevent this issue from happening in the future.
Is there any way you guys can reproduce this so we can re-test it?
I tried overbloating the databse and resetting the cache (deleting the cache.js) and hoped that the database would be corrupted, but couldn't get to this situation.
Let's keep this thread open if anything similar happens, hopefully the latest patch fixes this and we can avoid any database corruption in the future.
The exact same thing happened to me and haven't been able to reproduce it ever since.
Thanks for digging into this Steph, all the info helps.
I had this error happen today on version 3.1.1 with a server running PHP 7.3. When it happened my web page quit responding so I thought my server went down but my host showed me error logs that brought me to this forum. Since I thought it was a server issue I don't really remember what I was doing when it happened. Whether it occurred after a login/logout or posting new info I don't know (I was doing both multiple times before it happened). Looking at the database with the issue only part of the end was cut off. I have 3 plugins installed: additional-contents, contact-form, hits-counter.