When creating an external database connection with JDatabase::getInstance(), it is possible the connection is not created. However since the new Joomla 3.4.7, the disconnect() method (mysqli) tries to check for $this->connection->stat().
This fails and throws an error when $this->connection is empty.
Fatal error: Call to a member function stat() on a non-object in .../libraries/joomla/database/driver/mysqli.php on line 202
I have hacked this solution into my website now:
/libraries/joomla/database/driver/mysqli.php line 202:
if (!empty($this->connection) && $this->connection->stat() !== false)
Install Fabrik from github: github.com/Fabrik/fabrik/
Log into admin and then view this url:
The bug produces the error:
" Fatal error: Call to a member function stat() on null in F:\Users\rob\PhpstormProjects\fabrik31x\public_html\libraries\joomla\database\driver\mysqli.php on line 202"
After Peter's suggested fix the same page no longer produces an error.
On this i want to tell you that on some of my sites I'd a similar issue also in joomla < 3.4.7: a warning was issued for 'already closed connection' (i don't remember the exact message) on the
i always put this to prevent it:
|Closed_Date||0000-00-00 00:00:00||⇒||2015-12-24 11:30:42|
We've slightly reworked this check in 3289e7d based on some feedback that we still occasionally got
Fatal error: Uncaught Error: Call to a member function stat() on boolean in libraries/joomla/database/driver/mysqli.php on line 219
from the stack trace it seemed to happen in a scenario where either the class was instantiated and never connects (i got it on the first page of the installer, there’s no DB connection at all there) or disconnects before the destructor is called.
I got the Fabrik team to test this as well before committing it. But if any other's in here have any time to check as well all the better :)