PDA

View Full Version : bridge vbulletin $db conflict with existing $GLOBALS['db']


foxfirediego
10-27-2010, 06:55 PM
Hi there, I'm trying to bridge a software with vB, but if I include the './global.php' file, I get the following:

Fatal error: Call to a member function query_read_slave() on a non-object in .\vbulletin\includes\functions.php on line 3205

This is the code I was trying to use to be able to avoid that, no success tought:

$_SESSION['original_db'] = $GLOBALS['db'];
unset($GLOBALS['db']);
//here the $GLOBALS['db'] doesn't exist
require_once('class.vbulletin-bridge.php');
//my vb functions/methods/etc
$GLOBALS['db'] = $_SESSION['original_db'];


Running vBulletin 3.8.6

Here is the file I'm using which works pretty well:
http://www.phpclasses.org/browse/file/28845.html

Any help is appreciated.
Thanks
Diego

kh99
10-27-2010, 07:46 PM
I'm not sure what your code is doing, but I think that error indicates that $vbulletin->db is not set.

foxfirediego
10-27-2010, 10:59 PM
Hi kh99, thanks for your reply.
I think that it's conflicting with the existing $db that's set already for the main app which I'm trying to brigde with.

Anyway, thank you, I'll try to figure it out with what you said.

kh99
10-27-2010, 11:14 PM
No, I get it now - $vbulletin->db is a reference to the global $db, so you're trying to make sure that doesn't get clobbered.


Anyway, thank you, I'll try to figure it out with what you said.

Hmm...probably best to ignore what I said. :)

foxfirediego
10-27-2010, 11:33 PM
exactly hehe
the issue happens just after including the global.php file
maybe I'll just use curl to post to that file, but it will not be a correct thing to do - oh wel