This is the code I've used all the way up until PHP 7.2 which has broken this.
Excuse my ignorance, but what do I need to change for this to work again
class object {};
$siteinfo = mysqli_fetch_object(mysqli_query($GLOBALS["dbconn"], "SELECT * FROM tbl_siteinfo WHERE siteid = 1"));
$CFG = new object;
$CFG->wwwroot           = $siteinfo->siteurl;
$CFG->mainpage          = $siteinfo->mainpage;
$CFG->sitename          = $siteinfo->sitename;
$CFG->dirroot           = $siteinfo->dirroot;