View Full Version : if (!isset($GLOBALS['vbulletin']->db))
Captain Tycoon
03-19-2013, 10:20 PM
Can anyone tell me what that means?
if (!isset($GLOBALS['vbulletin']->db))
Do you want the full explanation or the bottom line? Basically it's saying "if the vbulletin database connection hasn't been initialized". Seems most likely that's it just a "safety" check rather than something that's expected to happen.
Captain Tycoon
03-19-2013, 10:51 PM
Thank you,
I asked because it does happen which stumped me and I wasn't sure what it meant. Although what I don't understand is the database connection is fine on all other pages except the includes/paymentapi/class_2checkout.php and the other class files in the same folder - this only recently started happening so I'm not really sure what's causing it (visiting the link directly).
Oh, yeah, that script is not meant to be visited directly. It's only meant to be included by other scripts, which would have the database object created already. But to be honest I don't really understand the reasoning behind doing that check since the only thing in the file is a class definition.
ETA: I notice that it's at the top of many files, so I guess it's a standard thing that they decided to put at the top of each file that's meant to only be included, to head off any unforseen issues if someone accesses it directly.
Paul M
03-20-2013, 09:52 PM
Its actually checking if the database class exists, not if you have a connection, but yes, its just a sanity check.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.