[ticket/11660] Fix bugs from bugs in #11651 (missing vars, db->sql_connect)

PHPBB3-11660
Merge remote-tracking branch 'EXreaction/ticket/11660' into develop

* EXreaction/ticket/11660:
  [ticket/11660] Fix bugs from bugs in #11651 (missing vars, db->sql_connect)