Skip to content

Commit 0d9819d

Browse files
committed
Updated the get_module_db call fixing a rare condition
1 parent bac9bf9 commit 0d9819d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/modules.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,13 @@ function get_module_db($module)
142142
if ($module != '' && $module != 'default') {
143143
myadmin_log('myadmin', 'info', "Tried to get_module_db({$module}) and GLOBALS[{$module}_dbh] does not exist, falling back to GLOBALS['tf']->db", __LINE__, __FILE__, $module);
144144
}
145-
return clone $GLOBALS['tf']->db;
145+
global $default_dbh, $tf;
146+
if (is_object($tf) && method_exists($tf, 'db')) {
147+
return clone $tf->db;
148+
} else {
149+
return clone $default_dbh;
150+
}
151+
146152
}
147153
}
148154
}

0 commit comments

Comments
 (0)