I have the following code:
//init X (DB initialization with credentials)
$x = MySqlConnector::getMySql();
//I destroy $x
unset($x);
$x = null;
//I try to re-initialize the database, but it is already initialized
//as evident from my logs
$x = MySqlConnector::getMySql();
Relevant function:
public static function getMySql()
{
if (null === static::$instance)
{
include 'include/config.php';
static::$instance = new MySql(DBHOST, DBUSER, DBPASS);
}
return static::$instance;
}
That tells me that even after I kill off the variable that was holding the initialized object, somehow MySqlConnector
stayed in memory.
How? I don't think it works with any other non-static class.